Synchronized Server Socket

Synchronized Server Socket

BY 03 Sep 2013 Native Application Development

Hi all,

I have created a server socket and able to get the request from the TCP/IP client via port forwarding. when i try to send the response in the same socket, it fails.Not able to receive at the client side. below is the code to receive data from the socket after accepting the socket connection.

result r = E_SUCCESS;
unsigned long arg = 0;
ByteBuffer rxBuffer;
char data[5000];
if(null != __pCommunicatorSocket)
{
_pCommunicatorSocket->Ioctl(NET_SOCKET_FIONREAD, arg);
rxBuffer.Construct(arg);
r =_pCommunicatorSocket->Receive(rxBuffer);
}
if (r == E_SUCCESS)
{
// Release resource
rxBuffer.Flip();
rxBuffer.GetArray((byte*)data, 0, arg);
data[arg]=‘\0’;
AppLog(data);
}
r = __pCommunicatorSocket->Send(rxBuffer);
rxBuffer.Clear();
 
Can you help me ?
 
Best regards,
Mohan
Written by