Re: Local Connection
Re: Local Connection
- Subject: Re: Local Connection
- From: Michael Paluszek <email@hidden>
- Date: Sat, 30 Mar 2002 20:31:17 -0500
Dear Zack:
Thanks for the help! At your suggestion I changed the specified port in
OTInitInetAddress
to 0 and it now works! I didn't really need to specify a port.
Sincerely,
Mike
-------
Michael A. Paluszek
Princeton Satellite Systems, Inc.
33 Witherspoon Street
Princeton, New Jersey 08542-3207
USA
Telephone: (609) 279-9606
Fax: (609) 279-9607
URL:
http://www.psatellite.com
>
From: Zack Morris <email@hidden>
>
Date: Sat, 30 Mar 2002 14:24:14 -0500
>
To: Michael Paluszek <email@hidden>, <email@hidden>
>
Subject: Re: Local Connection
>
>
on 3/29/02 5:16 AM, Michael Paluszek at email@hidden wrote:
>
>
> I have a server application on the same machine as two client applications.
>
> The server listens on port 5000 and then makes a connection on another port.
>
> The two clients use identical OpenTransport code. The first client connects
>
> but the second gets an error when it tries to bind of -3150 which is a bad
>
> address error. If I make SocketSifter (a shareware application from
>
> www.ekimsw.com) the second client SocketSifter connects without a problem
>
> and the server transfers data to SocketSifter.) It seems that there is a
>
> problem with my client code. I've synopsized it below (leaving out my code
>
> that returns the error codes. The first error is with the bind.) Does anyone
>
> have any suggestions on what I am doing wrong?
>
>
Call SetFourByteOption() with IP_REUSEADDR right before your bind I
>
think. Also, you can't bind two listening or two udp endpoints to the same
>
port. Regular tcp endpoints work fine. Honestly, I've never had a need to
>
do this, because when I try to make a connection, I usually just ask OT to
>
give me any old port it comes up with.
>
>
//---------------------------------------------
>
>
SetFourByteOption( endpoint[k], INET_IP, IP_REUSEADDR, true );
>
>
//-----------------------
>
>
OTResult SetFourByteOption( EndpointRef ep, OTXTILevel level, OTXTIName
>
name, UInt32 value )
>
{
>
OTResult err;
>
TOption option;
>
TOptMgmt request;
>
TOptMgmt result;
>
>
// Set up the option buffer to specify the option and value to set.
>
option.len = kOTFourByteOptionSize;
>
option.level= level;
>
option.name = name;
>
option.status = 0;
>
option.value[0] = value;
>
>
// Set up request parameter for OTOptionManagement
>
request.opt.buf= (UInt8 *) &option;
>
request.opt.len= sizeof(option);
>
request.flags = T_NEGOTIATE;
>
>
// Set up reply parameter for OTOptionManagement.
>
result.opt.buf = (UInt8 *) &option;
>
result.opt.maxlen = sizeof(option);
>
>
err = OTOptionManagement(ep, &request, &result);
>
>
if( !err )
>
if( option.status != T_SUCCESS )
>
err = option.status;
>
>
return( err );
>
}
>
>
Zack Morris
>
Z Sculpt Entertainment
>
email@hidden
>
http://www.zsculpt.com
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.