Results 1 to 2 of 2

Thread: [RESOLVED] Getting the server to send a message back to the client

  1. #1
    Frenzied Member
    Join Date
    Dec 01
    Posts
    1,330

    Resolved [RESOLVED] Getting the server to send a message back to the client

    Hello,

    I am created a client server application using the poco libraries. And using UDP.

    However, I would like to do something with the data and then send it back to the client.

    However, I don't know how to send back to the client, once the server has received the data from the client.

    Here is my code for the client, as simple as I can get it.
    Code:
    Poco::Net::SocketAddress addr("PiyaLim", 6000);
    		Poco::Net::DatagramSocket sock;
    		
    		sock.sendTo("Manchester United",17,addr);
    Code for the server:
    Code:
    char buffer[256] = {0};		
    			sock.receiveFrom(buffer,sizeof(buffer), addr);
    			std::string message = buffer;
    			int strLength = 0;
    			strLength = message.length();
    			message = message.substr(0,strLength);
    
    			std::cout << "*********************** START ***********************************************" << std::endl;
    			std::cout << "The message is: " << message << " The length of the string is: " << strLength << std::endl;
    			std::cout << "Address: " << addr.host().toString() << std::endl;
    			std::cout << "Port Number: " << addr.port() << std::endl;
    			std::cout << "*********************** END *************************************************" << std::endl;
    Many thanks for any help with this.

    Steve
    steve

  2. #2
    Fanatic Member drivenbywhat's Avatar
    Join Date
    Jan 07
    Location
    VA - USA
    Posts
    866

    Re: Getting the server to send a message back to the client

    Well I don't know anything about poco or what language you seem to be using (c?). However, it looks like you know how to send data from the client to the server. What's stopping you from doing the same from the server to the client? It should be the send thing. Once you manipulate the data, store it in a variable and send it back to the client and have it ready to receive.
    [vb5 & starting to move to vb2008] I appreciate the help I get from everyone. Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •