• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Local Connection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Local Connection


  • Subject: Re: Local Connection
  • From: Zack Morris <email@hidden>
  • Date: Sat, 30 Mar 2002 12:24:14 -0700

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.

  • Follow-Ups:
    • Re: Local Connection
      • From: Michael Paluszek <email@hidden>
References: 
 >Local Connection (From: Michael Paluszek <email@hidden>)

  • Prev by Date: Re: macnetworkprog digest, Vol 3 #83 - 11 msgs
  • Next by Date: Re: Local Connection
  • Previous by thread: Local Connection
  • Next by thread: Re: Local Connection
  • Index(es):
    • Date
    • Thread