// in FD_ACCEPT message of WM_SOCKET
// where client is defined as SOCKET client
// where incoming is the listening socket
int sizeaddr = sizeof (sockaddr);
client = accept (incoming, &client_sock, &sizeaddr); // accept a connection
if (client == INVALID_SOCKET)
{ // error accepting connection
WSACleanup ();
return 0;
}
else
{ // client connected successfully
WSAAsyncSelect(client, g_hwnd, WM_SOCKET, FD_READ | FD_CLOSE);
return 1;
}
// then, when I go to send if I'm connecting to another comp and outgoing is the socket to that comp:
send(outgoing, szSendBuff, str.size()+sizeof(dwSize), 0);
// that works fine. but, if I am the comp being connected to and client is the socket from FD_ACCEPT:
send(client, szSendBuff, str.size()+sizeof(dwSize), 0);
// the other computer never gets the message.
Any suggestions? Thanks in advance.
My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t X
R- tv+ b++ DI+(+++) D- G e* h!"
Decode my geekcode!
Geekcode.com
Visit our web site: Asylum Entertainment Edited by - ziplux on 12/16/00 2:40:23 PM