Thread: Client/Server Socket Receive Problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    6

    Question Client/Server Socket Receive Problem

    Im trying to send an array from the server application to the client on the same machine. The array is loaded and Sent from the server and recieved at the client but the array seems to be empty on the client side. I am using the socket.Receive function on the client side. I can send string messages back and forth without any problems. I am using Visual C++ MFC IDE tool to generate program.

    Code:
    //This is the server side declaration and Socket Send. I know that on the array has data in it on the server side
    
    struct Countries
    {
    	CString m_strCountries;
    	double m_lOffset;
    	CString m_strSummer;
    };
    Countries Acountries[CLEN];
    
    iSent = m_sConnectSocket.Send(Acountries,NULL,NULL);
    
    //This is the client side declaration an Socket Receive
    
    struct Countries
    {
    	CString m_strCountries;
    	double m_lOffset;
    	CString m_strSummer;
    };
    
    Countries Acountries[CLEN];
    
    iRcvd = m_sConnectSocket.Receive(Acountries,NULL,NULL);
    
    
    //Receive the message ** This is what I use to get the string
    // messages that work correctly for both client and server
    
    char *pBuf = new char[1025];
    	int iBufSize = 1024;
    
    	iRcvd = m_sConnectSocket.Receive(pBuf, iBufSize);

    Any and all comments greatly appreciated.

    MER
    Last edited by mariabair; 12-23-2003 at 11:35 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Datagram Unix socket problem
    By karas in forum C Programming
    Replies: 9
    Last Post: 07-27-2006, 10:08 AM
  2. RE: client/server shared memory problem
    By hampycalc in forum C Programming
    Replies: 0
    Last Post: 03-10-2006, 02:26 PM
  3. sock receive fdset problem
    By yahn in forum Networking/Device Communication
    Replies: 6
    Last Post: 03-03-2006, 05:34 PM
  4. Please Help! Socket Problem
    By robsmith in forum C Programming
    Replies: 2
    Last Post: 05-06-2005, 12:35 PM
  5. Socket programming problem.
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 10-14-2002, 08:44 PM