FTP and sockets hanging

paul katich

New member
Joined
Oct 16, 2009
Messages
1
Programming Experience
Beginner
Hi all,
I have an old application developed in vb.net 2003. The application uses sockets for transferring data to ftp sites. It uses
synchronous sockets.

' Upload the file

m_Bytes = Input.Read(m_Buffer, 0, m_Buffer.Length)

objEventLog.WriteEntry("start data transfer")
Do While (m_Bytes > 0)


<strong>DataSocket.Send(m_Buffer, m_Bytes, 0)</strong>
m_Bytes = Input.Read(m_Buffer, 0, m_Buffer.Length)
Loop
Its work well lot of times. But occasionally it hangs while sending. The reason I am thinking is a connection drop. I planning on using asynchronous sockets (use beginsend instead send). Can you let me know the approaches that will solve connection drop problems? I want to prevent the application from hanging.

If I set socket.blocking = false and set a send time out using setsocketoption can It prevent the hang?
Or Should I just use asynchronous sockets?
 
Back
Top