(file) Return to wsock32_main.c CVS log (file) (dir) Up to [RizwankCVS] / wine4 / wine / dlls / wsock32 / tests

Diff for /wine4/wine/dlls/wsock32/tests/wsock32_main.c between version 1.10 and 1.11

version 1.10, 2005/02/22 02:28:50 version 1.11, 2005/02/22 04:33:16
Line 117 
Line 117 
         clientsDone++;         clientsDone++;
 } }
  
 void ProcessConnection(SOCKET ConnectedSocket)  void ProcessConnection(SOCKET *ConnectedSocket)
 { {
         // 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;
Line 125 
Line 125 
         //ok(bClosed,"Error closing socket");         //ok(bClosed,"Error closing socket");
 } }
  
 void BlockingServer(int *port)  void BlockingServer(int *port) // listens for incoming connections and accepts up to NUM_CLIENTS connections at once
 { {
         HANDLE* ServerThreads;          HANDLE* ServerThreads; // the handles for the threads that process connections
         DWORD* ServerThreadIDs;          DWORD* ServerThreadIDs; // the thread ids for the threads that process connections
           SOCKET* ConnectedSockets; // the threads created by accept() that get sent to the processing function
         int ThreadIndex = 0;         int ThreadIndex = 0;
  
         SOCKET sock, ConnectedSocket;          SOCKET sock;
         SOCKADDR_IN server;         SOCKADDR_IN server;
           Handle* ServerThreads;
           DWORD* ServerThreadIDs;
           int ThreadIndex = 0;
   
         StartNetworkApp(SOCK_STREAM, &sock, &server);         StartNetworkApp(SOCK_STREAM, &sock, &server);
         *port = server.sin_port;         *port = server.sin_port;
  
Line 142 
Line 147 
         ServerThreadIDs = malloc(sizeof(DWORD) * NUM_CLIENTS);         ServerThreadIDs = malloc(sizeof(DWORD) * NUM_CLIENTS);
         memset(ServerThreadIDs, 0, sizeof(DWORD) * NUM_CLIENTS);         memset(ServerThreadIDs, 0, sizeof(DWORD) * NUM_CLIENTS);
  
           ConnectedSockets = malloc(sizeof(DWORD) * NUM_CLIENTS);
           memset(ConnectedSockets, 0, sizeof(DWORD) * NUM_CLIENTS);
   
         //SOCKADDR_IN RemoteAddress;         //SOCKADDR_IN RemoteAddress;
  
         // condition for how long we want the test to run goes here          ListenReturn = listen(sock, 5);
           ok(ListenReturn != SOCKET_ERROR, "error listening on socket");
   
           for (ThreadIndex = 0; ThreadIndex < NUM_CLIENTS; ThreadIndex++)
         {         {
                         ok(listen(sock, 5) != SOCKET_ERROR, "error listening on socket");                          ConnectedSocket = accept(sock); // this can be modified to include the address of the remote socket
                         //ok(INVALID_SOCKET != (ConnectedSocket = accept(sock)), "error accepting socket"); // this can be modified to include the address of the remote socket                          ok(ConnectedSocket != INVALID_SOCKET, "error accepting socket");
                         ServerThreads[ThreadIndex] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) &ProcessConnection, &ConnectedSocket, 0, &ServerThreadIDs[ThreadIndex]);  
                         // the line above needs to be cleaned up, it currently copies the connected socket into the called function                          ServerThreads[ThreadIndex] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) &ProcessConnection, &ConnectedSockets[ThreadIndex], 0, &ServerThreadIDs[ThreadIndex]);
                         // and will then overwrite the local variable.  I'm thinking maybe it needs an array of sockets to handle this  
                         // and then it can pass the address of the socket.  
         }         }
  
         // network code here         // network code here
  
         free(ServerThreads);         free(ServerThreads);
         free(ServerThreadIDs);         free(ServerThreadIDs);
           free(ConnectedSockets);
         trace("blocking server done\n");         trace("blocking server done\n");
 } }
  


Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

Rizwan Kassim
Powered by
ViewCVS 0.9.2