Jump to content

Possible DSWifi bug, anyone else had similar issues?


azaydius

Recommended Posts

I am wondering if anyone else has had similar problems with socket send using DSWifi? We have been developing a simple FTP client for the DS (for a school project) and will be releasing it to the community, but would like to fix a major bug we have been baffled by. We are able to connect to ftp sites, change directories, disconnect, reconnect, download, etc... The problem lies when we try to upload files.

 

Essentially what happens is send fails when it has sent 8192 bytes. We have tried changing the buffer to a smaller size and the upload loop will iterate until the sent bytes reach this 'magic' number and then it returns error. Debugging this has been quite difficult as you can imagine. We have even setup a packet sniffer on the ftp server side in order to see what is going on and have received some malformed tcp packets during this process. This is what lead us to the error possibly being in the library. Receiving works wonderfully and there are no malformed packets during the download process.

 

Any thoughts or suggestions would be greatly appreciated!

Link to comment
Share on other sites

Hi, You are most certainly losing data, but it's not due to the wifi lib.

The current buffer size in the wifi lib is indeed 8192 bytes, which means the maximum number of bytes that can be sent is 8191 bytes. The "send" call does fail when you send more bytes than are available in the buffer- but it fails telling you how many bytes it sent; this is by the design of the BSD Sockets layer, to allow you to know that a certain number of bytes were sent.

I think it's very unlikely that you would be losing data if you handled the return code of send() appropriately and retried the send of the bytes that weren't sent until they were added to the buffer

 

Also, if you're pretty new to packet sniffers, a lot of times "malformed" packets come up in normal traffic. They're more likely in the case of DS traffic as the wifi hardware is far from perfect and often packets get retransmitted a lot. (wireshark/ethereal almost always mark duplicate packets as "malformed")

 

Let me know if you continue to have problems after fixing your use of send(), I'm not aware of any errors in this code path but it's not a very well tested one.

 

-Stephen

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...