Problem reading hexadecimal buffer from C socket

Posted by Olaseni on Stack Overflow See other posts from Stack Overflow or by Olaseni
Published on 2010-03-17T21:41:10Z Indexed on 2010/03/20 1:01 UTC
Read the original article Hit count: 483

Filed under:
|

I'm using the SDL_net sockets API to create a server and client. I can easily read a string buffer, but when I try to send hexadecimal data, recv gets the length, but I cannot seem to be a able to read the buffer contents.

IPaddress ip;
TCPsocket server,client;
int bufSize = 1024;
char message[bufSize];
int len;

server = SDLNet_TCP_Open(&ip);
client = SDLNet_TCP_Accept(server);
len = SDLNet_TCP_Recv(client,message,bufSize);

Here's a snippet. the buffer length "len" is set (i.e. message length) but I can't get to the data contents in the message buffer. Some sample bind_transmitter PDU data was sent by a random client to the server at that port. I can't read the PDU (SMPP).

© Stack Overflow or respective owner

Related posts about sockets

Related posts about recv