[ee122] Project 2 Question regarding MNL and the extra 2 bytes for the port.

Lisa Fowler fowler at eecs.berkeley.edu
Tue Dec 4 21:35:06 PST 2007


On Dec 4, 2007 9:07 PM,  <phamductri at berkeley.edu> wrote:
> Hello. So I'm having an issue with MNL and grabbing the port of the sender
> to be able to send ACKs back to the receiver. I have stop and wait working
> just fine with different files for plain vanilla UDP.
>
<snip>
>
> Why isn't the extra 2 bytes being padded to provide the port? Am I missing
> something?

See my post to the list on Nov 25 "[ee122] gathering info with random
unused ports (sin_port == 0)"

You should be writing in those 2B yourself (see the code in TestSend.c
line 137).  It isn't done automatically.

> Also, in TestRecv.c, there is no conversion from network order to host
> order. Shouldn't that also be a concern?

Good catch.  Yes it is a concern if TestSend and TestRecv are compiled
on different machines that represent uint16_t's differently.  You
should take care of this in your program.

-Lisa


More information about the ee122 mailing list