Socket stopped working!

  • Thread starter Thread starter Brian Taylor
  • Start date Start date
B

Brian Taylor

We have a FTP copy program that queries a number of sites for data. However
it suddenly stopped working on Windows Server 2003 (but it still works fine
on Windows XP). What is more confusing is that it stopped for only 2 ftp
servers out of around 15 (Unix servers)! Note that other ftp clients can
still connect to these Unix servers.

The code (below) failes on the connection. Note that "iRet" gives a value of
"0", which according to the documentation, I think means that the connection
was shutdown by the server. If this is the case why would this just start
happening? How can we debug this problem?

Brian


FTPSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
IPEndPoint ipend = new IPEndPoint(Dns.Resolve(Host).AddressList[0],Port);

FTPSocket.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.ReceiveTimeout, 60000);

FTPSocket.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.SendTimeout, 60000);

FTPSocket.Connect((EndPoint)ipend);

FTPStream = new NetworkStream(FTPSocket,FileAccess.ReadWrite,true);

FTPWriter = new StreamWriter(FTPStream);

iRet = FTPSocket.Receive(abyBuffer,0,4096,SocketFlags.None);
 
Hi Brian,

From your description, you have a .net based socket program ( a FTP client
app) which will need to access some UNIX servers to copy files. This app
used to work well. but failed on some WIN2K3 client box when accessing some
certain UNIX servers, yes? If there're anything I misunderstand, please
feel free to let me know.

Based on my understanding, the problem seems related to the UNIX SERVER BOX
which maybe block the connection sent via your app. Currently I also
haven't any good ideas, but I think you can try using the netmon tool to
trace the raw connection between your 2003 box and the server with problem.
You can check whether the server actually return datas to your client or
event hasn't return datas. If the server has returned the correct data and
we still get 0 from the "Receive" method, there maybe something wrong with
the client side.

If you have any further questions or findings ,please also feel free to
post here.
Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Steven,

Thanks very much for your reply. We have investigated further and found that
the ftp software works fine on other Windows 2K3, Windows 2K server and
Windows XP computers. We are therefore quite unclears as to why the softare
has just started to fail on this Windows 2K3 server. It has not undergone
any configuration changes or software installations. We checked it again and
the "Receive" method returns 0 and the buffer is empty. We have not looked
at netmon as yet but have moved the ftp copy on to another server to fix the
problem.

Brian
 
Thanks for your followup, Brian.

Seems the problem is likely due to that certain server machine based on
your further info. Anyway, glad that your work can continue now. Also, if
you need any further help later, please feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top