.NET Framework Bookmark and Share   
 index > .NET Framework Networking and Communication > TCP/IP Client Send and Receive Timeout
 

TCP/IP Client Send and Receive Timeout


Hi,

I am using the following TCP/IP Asynchronous socket example to do my application.

http://msdn.microsoft.com/en-us/library/bew39x2a.aspx


My program will use TCPIP connection to send ISO8583 financial message to Unix host server. The problem is, sometimes after my client program sent out message to Unix server, the message didn't even reached to server.

So, there will be no response sending back from the server. In this case, the client program should reach to send/receive timeout interval and should stop the communication.

But, it didn't happen like that. The program was keeping running until manual shut down to it by the task manager.

Since, this client program was called by web interface to send financial message to Unix host, there are a lot of client program instances left open in task manager.

But, this case is happening only some times. After manual shut down at task manager, the process run as expected.

What I would like to know in this case is,
- why the message didn't sent out to server?
- why the timeout is not really firing and shut the client program down?


Thanks in advance,






Myo Zaw
  • Moved byLingzhi SunMSFT, ModeratorSunday, March 08, 2009 2:17 AM (Moved from Visual C# General to .NET Framework Networking and Communication)
  •  
MyoZaw
Once you send out a message on a socket, you're guaranteed one of two things:
1) The message was received by the remote machine.
2) You get an error back that the message could not be delivered.

It's not possible to just have a message enter "limbo". Double-check whether it's getting received.

-Steve
Stephen Cleary

Hi Steve,

Thanks for your reply. I don't understand what you mean by 'enter "limbo"'. Can you explain me a little bit?


Thanks,


Myo Zaw
MyoZaw
What Stephen means is that the message you send to the remote computer won't just disappear. It'll either be delivered, or it won't. Either way, you're guaranteed that one of those two options will happen, and you can check which one happened. His advice is to check to see if the message has been received by the remote machine.
David Morton - http://blog.davemorton.net/
David M Morton

Hi David,

Thanks for the explanation.


Hi Steve,

In fact, I have a log checking when the message sent out and when the reply come in. For this case, I see that the message was sent out according to the log information. But, what is strange is that the remote host didn't receive what I sent out and didn't see any incoming from my site.

Since, the host didn't sent anything back, my client suppose to reach to its timeout interval as it was waiting the response. But, the client didn't fire the receive timeout also.

Is it strange or do you need to know more about this problem?

I have checked my client application with .net socket server and simulate this case. For some case, I didn't reply anything from socket server. But, my client application always reach to the timeout interval for this testing.


Thanks,
Myo


Myo Zaw
MyoZaw
Can you provide same code?
Hitesh
Hitesh Kesharia
On the timeout issue only, if you are using the ReceiveTimeout property, then note that it does not apply to asynchronous calls;see "This option applies to synchronous Receive calls only." athttp://msdn.microsoft.com/en-us/library/system.net.sockets.socket.receivetimeout.aspx
http://www.alanjmcf.me.uk/ Please follow-up in the newsgroup. If I help, mark the question answered
Alan J. McFarlane

Hi Alan,

Many thanks for clearing this. So, according to this MSDN documentation, this receivetimeout interval that I'm using isn't working for my Asynchronus connection.

May I ask how should I stop my waiting status of reply message?


Thanks.

Myo Zaw
MyoZaw
If the send has completed successfully, then the server machine got the message. In this case, the TCP/IP "retry send until timeout"parameters don't apply because the send succeeded.

When receiving, you'll need an explicit timer. TCP/IP was designed to allow connections to remain open forever and always reading. So, if you want a server response within a certain amount of time, you'll need to use your own timer.

-Steve
Stephen Cleary
Hi All,
I am looking for a way to send ISO8583 financial message from mobile device to the financial center using C# (.NET framework 2.0). I am pretty new in this whole thing. If you could give me a hint on how to send, I would truly appreciate it. Thank you very much.
Soe
Soe Htwe

You can use google to search for other answers

Custom Search

More Threads

• How can i know whether any message has come to queue in MSMQ
• cannot download files
• How to Web Automation and Testing in C#?
• vb.net and Terminal Server help
• Visual studio .NET 2003 and the compact framework 2.0
• Simple task - Upload a file to a web server.
• Lightest possible way to determine of a remote file exists
• Pop3 authentication
• How do i track whether the given url is valid or not?
• High performance sockets and SslStream