Thread: async socket issues

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    254

    async socket issues

    well im having some difficulties sending to the server i send but it never reaches the server?

    anyways im including everything i think is relevant :P
    Code:
    case WM_WSAASYNC:
    		{
    			switch(WSAGETSELECTEVENT(lParam))
    			{
    			case FD_READ:
    				{
    					buffer=ReadData(hwndServerBox);
    					if(buffer.length()>0)
    						Analyze(hwndServerBox,buffer);
    				}break;
    
    //-----------------------------------------------------------------------------------
    bool WriteData(HWND hwndServerBox,string buffer)//the issue is in here as my data is never actually sent?
    {	
    	int nret;
    	int BytesToSend=sizeof(buffer);
    
    	if (BytesToSend<=0)
    		return false;
    
    	nret=send(sock,buffer.c_str(),BytesToSend,0);
    
    	if(nret==SOCKET_ERROR)
    	{
    		PostText(hwndServerBox,"Error: Send()");
    		return false;
    	}
    	else
    		PostText(hwndServerBox,buffer);
    	return true;
    }
    i was told to disregard WM_WRITE as it is only useful when sending large amounts of data because you have to fill up the network buffer...
    Last edited by ZerOrDie; 03-16-2003 at 03:44 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. socket programming question, closing sockets...
    By ursula in forum Networking/Device Communication
    Replies: 2
    Last Post: 05-31-2009, 05:17 PM
  2. Winsock issues
    By tjpanda in forum Windows Programming
    Replies: 3
    Last Post: 12-04-2008, 08:32 AM
  3. async Client/Server app, accept() stalls?
    By JaWiB in forum Networking/Device Communication
    Replies: 14
    Last Post: 01-31-2005, 05:59 PM
  4. Error on Async socket startup!
    By SyntaxBubble in forum Windows Programming
    Replies: 4
    Last Post: 03-16-2002, 07:36 PM
  5. Async Socket Examples?
    By SyntaxBubble in forum Windows Programming
    Replies: 1
    Last Post: 01-04-2002, 06:08 PM