version 1.13, 2005/02/22 05:38:50
|
version 1.14, 2005/02/22 05:56:04
|
|
|
clientsDone++; | clientsDone++; |
} | } |
| |
void ProcessConnection(SOCKET *ConnectedSocket) |
void ProcessConnection(struct ServerThread t) |
{ | { |
// this will handle all connections to the server, it's in its own function to allow for multithreading | // this will handle all connections to the server, it's in its own function to allow for multithreading |
int bClosed; | int bClosed; |
bClosed = close(ConnectedSocket); |
bClosed = close(t.ConnectedSocket); |
//ok(bClosed,"Error closing socket"); | //ok(bClosed,"Error closing socket"); |
} | } |
| |
|
|
| |
for (ThreadIndex = 0; ThreadIndex < NUM_CLIENTS; ThreadIndex++) | for (ThreadIndex = 0; ThreadIndex < NUM_CLIENTS; ThreadIndex++) |
{ | { |
Threads[ThreadIndex].ConnectedSocket = accept(sock, (SOCKADDR *) &Threads[ThreadIndex].Client, &sizeof(SOCKADDR_IN)); // this can be modified to include the address of the remote socket |
Threads[ThreadIndex].ConnectedSocket = accept(sock, (SOCKADDR *) &Threads[ThreadIndex].Client, &sizeofSOCKADDR_IN); // this can be modified to include the address of the remote socket |
ok(Threads[ThreadIndex].ConnectedSockets != INVALID_SOCKET, "error accepting socket"); |
ok(Threads[ThreadIndex].ConnectedSocket != INVALID_SOCKET, "error accepting socket"); |
| |
Threads[ThreadIndex].ServerThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) &ProcessConnection, &(Threads[ThreadIndex].ConnectedSocket), 0, &Threads[ThreadIndex].ServerThreadID); | Threads[ThreadIndex].ServerThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) &ProcessConnection, &(Threads[ThreadIndex].ConnectedSocket), 0, &Threads[ThreadIndex].ServerThreadID); |
} | } |
|
|
{ | { |
// initialize application | // initialize application |
WSADATA wsaData; | WSADATA wsaData; |
int wsastartup_result = WSAStartup(MAKEWORD(1,1), &wsaData); |
int wsastartup_result; |
if ( (LOBYTE(wsaData.wVersion) != 1) && (HIBYTE(wsaData.wVersion) != 1) ) |
int versionOK; |
{ |
|
ok( 0 , "WSAStartup returns an incompatible sockets version"); |
wsastartup_result = WSAStartup(MAKEWORD(1,1), &wsaData); |
|
versionOK = (LOBYTE(wsaData.wVersion) == 1) && (HIBYTE(wsaData.wVersion) == 1); |
|
|
|
ok( versionOK , "WSAStartup returns an incompatible sockets version"); |
|
if ( !versionOK ) { |
WSACleanup(); | WSACleanup(); |
exit(0); | exit(0); |
} | } |
|
|
ok((wsastartup_result == NO_ERROR), "Error in WSAStartup()"); | ok((wsastartup_result == NO_ERROR), "Error in WSAStartup()"); |
} | } |
| |
|
|
START_TEST(wsock32_main) | START_TEST(wsock32_main) |
{ | { |
trace("test 1 of 2:\n"); | trace("test 1 of 2:\n"); |