Click to See Complete Forum and Search --> : Trouble using Winsock from c#.net


yat
February 12th, 2009, 01:38 PM
hello,
i am trying to transalte a code from VB6 which connects to a server and communicates with it to C# (after failing to do so with interop.)
first i tried converting to socket connection(TcpClient) but the connection
didn't seem to work quite well (the connection was forcibly closed by the remote host).
now i attempt using the MSWINSCK.OCX from my C# project. but when i get
to the DataArrived event, and call the GetData method - it does not return any value
and get stuck (control does not return to my code).
while in VB6 - it works just fine.

does anybody know why this might be caused? any better ways to emulate
winsock connection from .net projects?

thanks ahead!

verifier
February 23rd, 2009, 06:18 AM
I have never had any problems in C# with either TcpClient or Socket. Can you show us some code?

"the connection was forcibly closed by the remote host" means that the other side closed the connection. Maybe you sent something that it didnt expect?