socket() returning same value in shared library ( wasRe: accept() hangs)
socket() returning same value in shared library ( wasRe: accept() hangs)
- Subject: socket() returning same value in shared library ( wasRe: accept() hangs)
- From: Ken Baer <email@hidden>
- Date: Mon, 10 Oct 2005 11:29:09 -0700
I am porting a suite of WinSock based applications. We are using a
socket wrapper class that is in a shared Dynamic library. Right now
the server is running on a PC, but the Messenger and Slave are running
on a Mac (at the same time). The Messenger talks to the server, and
passes information back and forth between the Server and the Slave.
Messenger and Slave are sharing the same dynamic library that makes all
the calls to BSD socket functions.
I think the reason that the call to accept() called from the Messenger
is that the SOCKET value is the same from the listening socket on the
Messenger and the messenger socket that the Slave tries to connect
with. What's happening is that the BSD function socket() is returning
the same value (42) in the same dynamic library when called from 2
different applications. They are booth open.
Is there a way to insure that socket() returns a unique number in a
shared library environment?
On Oct 9, 2005, at 3:50 PM, Ken Baer wrote:
I am trying to set up communications between a server and a client. My
client calls connect(), and my server is getting an Accept message and
calls accept() with the SOCKET it got from the message callback. Then
accept() hangs. On the client side, connect() returns 0 and the
program continues, even before accept() is called on the server side.
The socket values seem correct, but I don't understand the behavior.
If I run the client without the server, the connect() fails as I would
expect it to.
I don't understand why accept() would hang in this situation.
-Ken Baer.
Hash, Inc.
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden