Mail Archives: djgpp/2001/01/21/11:21:32
Hello.
Sahab Yazdani wrote:
> > How are they garbled? Are the data in the wrong order? Do you get any
> > of the sent data when you do recv()?
>
> ok, i've been messing around with it a bit and have made a great deal of
> headway... i have gotten it to transmit a "MassacreHeader" structure
> over the network everytime perfectly. The problem now comes when I try
> to transmit the other two structure types: "MassacreChatPacket" and
> "MassacreBriefingRoomPacket".
What did you change? Why is the data no longer garbled? Knowing this could
help fix your other problems.
> I believe that this is because the packets are not getting there
> completely, and that my method just trucates it and then the error
> checking routines convert the data into error values (which is only the
> *name* field, the type and player field are garbled by the routines).
What type of sockets are you creating - TCP/IP or UDP/IP? E.g. are you
using:
- socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) for TCP/IP;
- or socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) for UDP/IP?
(Actually, you should use PF_INET instead of AF_INET.)
You should be able to send your headers in one packet, since they are
small.
> as a side note, when I print out the error using either lsck_perror or
> perror, i get this message "RETRIEVE1: Resource temporarily not
> available (EAGAIN)" over and over again with a stray "RETREIVE2: " " " "
> popping in there sometimes (only when data is being sent over the
> network).
Which version of Windows are you using? Do you have Winsock 2 installed?
What does the libsocket demo program demo/diag.exe display? You can
capture its output like so:
redir -eo diag.exe > diag.out
I've never seen this error, but other people have reported it. Perhaps it
only occurs with a small packet size? Strange. I would like to know why
that happens.
[snip]
> MassacreHeader CreateHeader( unsigned char packetType, unsigned char multiples ) {
> MassacreHeader retType;
>
> strcpy(retType.header, "MASS" );
Since retType.Header is a 4 char array, this will overflow the buffer and
overwrite retType.packetType, because "MASS" is 5 bytes - 'MASS\0'. If you
want space for the nul terminator, make header a 5 char array.
I still can't see anything wrong with the rest of your code.
Bye,
--
Richard Dawe <richdawe AT bigfoot DOT com> http://www.bigfoot.com/~richdawe/
"The soul is the mirror of an indestructible universe."
--- Gottfried W. Leibniz
- Raw text -