Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Wed Nov 22, 2017 7:28 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Comm error
PostPosted: Wed Jan 07, 2009 4:43 pm 
Offline
User avatar

Joined: Fri Feb 01, 2008 4:50 pm
Posts: 101
Are the possible errors sent to a MSG_COMM_ERROR handler the exceptions listed in appendix B.9 of the programmers reference manual?

EDIT: I don't think those are the errors, so if they aren't, where can I find them?


Top
 Profile  
 
 Post subject: Re: Comm error
PostPosted: Thu Jan 08, 2009 7:42 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
Here are the error codes (I don't think 0 can actually be generated, and I have never seen 5 and 6 in practice, even when working with urgent data -- I think they may be internal)

0 "no error",
1 "connection reset"
2 "connection refused"
3 "not enough buffer space"
4 "connection timed out"
5 "urgent data pending"
6 "end of urgent data"
7 "connection closed by foreign host"

And #7 isn't necessarily an error -- it can happen during well behaved connections where the other side initiates a normal shutdown.

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
 Post subject: Re: Comm error
PostPosted: Fri Jan 09, 2009 11:23 am 
Offline
User avatar

Joined: Fri Feb 01, 2008 4:50 pm
Posts: 101
Jeremy,

I am writing an Ethernet object that has timeouts implemented for both connecting to a remote server and for receiving data back after sending data. When connecting though, I have run into an issue. If I am connecting to a server that will eventually cause the "connection refused" error to occur, it will be issued even after making a call to netClose(). For instance, I am connecting to a server that eventually times out based on what I have implemented, makes a call to netClose, and then puts the object back in an idle state. Then, seconds later, the MSG_COMM_ERROR msg is sent to the object with the "connection refused" statement. Is there any way to stop that message from being issued after I have already closed/canceled the connection? If not, it seems as though I have no control over the connection timeout.

Thanks,

Ryan


Top
 Profile  
 
 Post subject: Re: Comm error
PostPosted: Fri Jan 09, 2009 11:34 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
The issue you are seeing is a sequence of events. Hopefully I am able to effectively illustrate this -- if not please let me know.

#1: You call NetOpen
#2: Time passes
#3: You call netClose (what exactly are you closing at this point anyway? Since you have not received a MSG_COMM_ACCEPT, you don't have anything to call NetClose on). Presumably you are calling NetClose on COM_INVALID, so nothing happens.
#4: You receive a MSG_COMM_ERROR.

In general, after successfully calling NetOpen, you must wait for either a MSG_COMM_ACCEPT or MSG_COMM_ERROR to be given to your object before you can take any further action. If you look at the source code to most of our network client objects, you will notice that after they call NetOpen they set a connection pending flag until they receive one of those two messages. When the connection pending flag is set, they don't allow the user to do anything to them.

If it is critical that you be able to time out more quickly than a normal TCP connection timeout, you will probably require multiple instances of your client object. If one times out, disable and flag it as timed out but pending a message, then bring your next one online.

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
 Post subject: Re: Comm error
PostPosted: Mon Jan 12, 2009 9:33 am 
Offline
User avatar

Joined: Fri Feb 01, 2008 4:50 pm
Posts: 101
I guess I forgot that my local ref to comm was invalid at that point in time :/.

I will likely have multiple instances of some type of handler then - thanks!!


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

All times are UTC - 7 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
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group