ndt-users - Re: recv_msg problem
Subject: ndt-users list created
List archive
- From: Richard Carlson <>
- To:
- Cc:
- Subject: Re: recv_msg problem
- Date: Thu, 10 Sep 2009 10:00:47 -0500
Hi Romero;
The NDT send_msg() and recv_msg() functions are not meant to be a generic communications protocol. They were designed to allow the server and client to exchange status information about what was happening. There is also a message type to allow the delivery of some data between the 2 nodes. The specific message types are defined in the protocol.h file. The send/recv functions are defined in the network.c file.
Looking at the recv_msg() function code you will see that it returns a value of 2 if the length (10) is greater than len (4). The length value is the size of the data message and len is the size of the char array needed to hold this data. Since you can't put 10 bytes into 4 slots, you get back an error message (2). You will need to fix your code to sent in a properly sized array.
Rich
On Sep 9, 2009, at 8:24 PM,
wrote:
Hi.
Im doing some modifications on ndt 3.5.0, but i have a problem:
Client side:
memset(buff, 0, sizeof buff);
sprintf(buff, "%-s", "xxxxxccccc");
n = send_msg(ctlSocket, 100 , buff, strlen(buff)); (n = 0 after this, that's ok)
in client's log: >>> send_msg: type=100, len=10
Server side:
memset(dbuff, 0, sizeof dbuff);
n = recv_msg(ctlsockfd, &msgType, dbuff, &msgLen);
dbuff[msgLen] = 0;
in server log: recv_msg: length [10] > *len [4]
after this n=2 and dbuff is empty, i don't know why read_msg is returning 2
any ideas?
Regards.
Richard Carlson
1000 Oakbrook Dr
Ann Arbor, MI 48104
P: 734-352-7043
C: 630-251-4572
- recv_msg problem, Daniel Romero, 09/09/2009
- <Possible follow-up(s)>
- recv_msg problem, romero . cl, 09/09/2009
- Re: recv_msg problem, Aaron Brown, 09/10/2009
- Re: recv_msg problem, Richard Carlson, 09/10/2009
- Re: recv_msg problem, Daniel Romero, 09/10/2009
- Re: recv_msg problem, Daniel Romero, 09/10/2009
- Re: recv_msg problem, Richard Carlson, 09/10/2009
- Re: recv_msg problem, Daniel Romero, 09/10/2009
- Re: recv_msg problem, Daniel Romero, 09/10/2009
Archive powered by MHonArc 2.6.16.