Jump to content
  • Advertisement
Sign in to follow this  
Ravuya

HawkNL: "The namelen argument is incorrect"

This topic is 4834 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to work on a multiplayer game server in HawkNL, and whenever I try to write my packets to the client, I get a system error: "The namelen argument is incomplete". Cursory googles appear to reveal nothing (other than that this error is also in WinSock), so what exactly does this error mean and what should I do to resolve it? I get this regardless of client (both netcat and my "official" client do this) and computer (either connecting from across my LAN or on the same machine). Netcat fills up with "NLNLNLNLNLNLNL..." over and over and my client receives "NL" then gets a "The NL_RELIABLE_PACKET stream is out of sync" error, FYI. Changing the mode from NL_RELIABLE_PACKET to NL_RELIABLE (on both client and server) makes the error on the client disappear (as well as the "NLNLNLNL" on netcat), although the namelen error still exists on the server and so nothing gets "sent" to the client. My rough assumption is that the server needs to somehow know the name of the remote socket in order to communicate with it and this is not done automatically.

Share this post


Link to post
Share on other sites
Advertisement
It's kind of hard to give any advice if you don't even mention what function is giving you this error, or how you are calling it.

Share this post


Link to post
Share on other sites
Quote:
Original post by SiCrane
It's kind of hard to give any advice if you don't even mention what function is giving you this error, or how you are calling it.


Woops. I'm using:

nlWrite(player->getSocket(), thisPacket->serialize(), thisPacket->getSize())


player->getSocket() returns the NLsocket that the player originally connected with (that was retrieved from the listener).

thisPacket->serialize() returns a serialized version of the packet (as char*) that is intended to be tossed over the network. I have a wager this code is buggy, but it's not even getting sent out so I can't check to see if it's making proper packets yet.

thisPacket->getsize() just returns the size in bytes of the serialized packet. For the one I'm testing, it should send 14 bytes. (two floats, 3 unsigned short ints).

From the HawkNL documentation, I'm told that nlWrite returns the number of bytes written or NL_INVALID (-1) on failure. I detect the -1 and then go to use the HawkNL functions for printing out the system error.

Share this post


Link to post
Share on other sites
Check the return value on thisPacket->serialize(). One possible cause of a EFAULT is that the pointer specified in call to send() is a non-valid address such as that reserved for kernal addresses or IIRC the null pointer.

Share this post


Link to post
Share on other sites
Quote:
Original post by SiCrane
Check the return value on thisPacket->serialize(). One possible cause of a EFAULT is that the pointer specified in call to send() is a non-valid address such as that reserved for kernal addresses or IIRC the null pointer.


That may be it. I just now notice that trying to printf the char* I get back from there causes a segmentation fault, unless I print it out in hex which returns 1000e (and is much too short to be 14 bytes). Just sending a dummy string like "moo" appears to go through fine without triggering the error.

I'll look over my serialize function some more.
Edit: Ahah! memcpy(buf, &myStruct, sizeof(myStruct)) NOT memcpy(&buf, &myStruct, sizeof(myStruct)). Doyyyyyyy. Stupid pointers.

[Edited by - Ravuya on July 24, 2005 8:06:48 PM]

Share this post


Link to post
Share on other sites
If this a windows box, the address 100e lies in the protected lower memory area, which will register a EFAULT.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!