Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Oct 23, 2019 10:04 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Undocumented UDP Error Codes
PostPosted: Fri Nov 28, 2008 4:12 am 
Offline

Joined: Tue Sep 23, 2008 4:33 am
Posts: 20
I am currently using an UDP for communication between the realbasic application I am working on and a server, nearly everything works as intented but the error callbacks sometimes return an error with code 40 resulting in the socket being no longer operationnal.

My application runs on Mac OS X so if I trust the documentation the error code should be superior to 100 for rb errors or negative for system errors, so... what the hell 40 is ???
As a side note I also got an error 2 whil trying to send datagram without destination address/port.

The error 40 seems to be triggered when trying to send big packet, is there a limit to the UDP packets size ?
My current understading of UDP is that you can put anything in them and the network layer will decompose it before sending and recompose it at the other end, I already have in place an acknowledge system to ensure packets are received by the other end.

Any help is welcome I am really starting going crazy trying to find out what is happenning with those unknown error codes.


Top
 Profile  
Reply with quote  
 Post subject: Re: Undocumented UDP Error Codes
PostPosted: Fri Nov 28, 2008 11:34 am 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
Schmurfy wrote:
I am currently using an UDP for communication between the realbasic application I am working on and a server, nearly everything works as intented but the error callbacks sometimes return an error with code 40 resulting in the socket being no longer operationnal.



UDP is fast, but not reliable
Packets can be dropped without error and can arrive in any order

TCP is pretty darned fast, reliable and packets arrive in order

If you need reliability use a TCP socket

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: Undocumented UDP Error Codes
PostPosted: Wed Dec 03, 2008 8:45 am 
Offline

Joined: Tue Sep 23, 2008 4:33 am
Posts: 20
I already know that, our error control mechanism is already in place and working and using udp packets allow us to have even faster communication but my only problem is why I get undocumented error codes and what an error code 40 means on mac os x.

Trusting the documentation I should not even receive this error code but I do...


Top
 Profile  
Reply with quote  
 Post subject: Re: Undocumented UDP Error Codes
PostPosted: Wed Dec 03, 2008 11:12 am 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
error correction ?
you do realize that TCP adds all that "for free" and even assures that packets are in order

that aside it could be an OS level error code

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: Undocumented UDP Error Codes
PostPosted: Thu Dec 04, 2008 12:33 am 
Offline

Joined: Mon Jul 17, 2006 10:39 am
Posts: 1718
If the error code is not documented in RB's docs, then it is surely an OS error of some kind.

Assuming it is a Mac OS error code, error 40 would translate to dsGreeting, a code used by the classic Mac OS to display the "Welcome to Macintosh" splash screen as the computer started up. Obviously this does not make any sense in this context, so I checked error -40, which is posErr, and has something to do with I/O.

Armed with that bit of information, and your previous description of the problem, I would wager breaking it your data into manageable chunks would solve the problem, as it seems you are clogging some internal buffer somewhere.

_________________
Kenneth McCleary
ken@mccleary.me


Top
 Profile  
Reply with quote  
 Post subject: Re: Undocumented UDP Error Codes
PostPosted: Thu Dec 04, 2008 5:34 pm 
Offline
User avatar

Joined: Thu Jul 27, 2006 6:31 pm
Posts: 1698
Location: Monterey, CA
I've run into problems with big UDP packets before and found conflicting information on the max UDP packet size. If you go over this limit the packet simply won't be sent. UDP is great for establishing client IPs and such. But, as others have suggested, I would use TCP for the actual data transmission. It will chunk the data for you and keep it in order.

_________________
ImagePlay Effects Library (40+ image effects in one open source module. No plugins, no dependencies, no restrictions.)
http://imageplay.sourceforge.net/


Top
 Profile  
Reply with quote  
 Post subject: Re: Undocumented UDP Error Codes
PostPosted: Thu Dec 04, 2008 8:44 pm 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
you better look into the unix error codes:

Quote:
/* ipc/network software -- argument errors */
#define ENOTSOCK 38 /* Socket operation on non-socket */
#define EDESTADDRREQ 39 /* Destination address required */
#define EMSGSIZE 40 /* Message too long */
#define EPROTOTYPE 41 /* Protocol wrong type for socket */
#define ENOPROTOOPT 42 /* Protocol not available */
#define EPROTONOSUPPORT 43 /* Protocol not supported */
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
#define ENOTSUP 45 /* Operation not supported */


Gruß
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: Undocumented UDP Error Codes
PostPosted: Mon Dec 08, 2008 9:34 am 
Offline

Joined: Tue Sep 23, 2008 4:33 am
Posts: 20
Thanks for your answers :)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group