المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : C# Socket programming not working in communication with linux machine.



C# Programming
07-24-2010, 06:31 AM
I have a SUSE linux machine running on the remote end which acts as tcp server.In the past this machine used to accept data over the serial port server, ie a piece of hardware that accepts serial data and converts it into TCP packets. I am trying to write an TCP/IP application to replace the port server.I am able to establish a connection between the linux machine but for some reason as soon as I send a Socket.Connect(remoteip), I am seeing SYN from my machine, SYN/ACK from linux, SYN/ACK from my machine and then SYN,FIN from linux machine and then ACK from my machine. I know that usually for a network communication, its supposed to be a three way handshake only. I see 5 channels of communication though instead of the 3. As soon as I send a packet, the linux machine sends a reset command.

I have something that can simulate what needs to be send to the remote linux machine. I compare my packats from the simulator and the packets I send , and the data packets are exactly the same. On the protocol level, there were some differences. The simulator had timestamps, so I added that using SocketOptions(....multicastdelay,1). The simulator was using a window size of 5480, so I set that using SocketOptions(..) also.

However still the linux machine is sending a reset packet as soon as I send data to it. I know that the linux machine server can accept TCP/IP communication in synchronous mode. I know the details of the what the data payload needs to be from a document and its maching the simulator . Thats all I know and I cannot get more information on it. The machine accepts data from a serial port server and works beatifully.

I am using socket programming and what i do can be summed up by the following three commands. Arguments are missing below but are correct in actual code.
socket.Connect()
socket.Send()
socket.Shutdown()
socket.Closet()

Another thing I noticed is that in Wireshark, when the simulator sends a Connect and when my machine sends a Connect, the TCP/IP options are in different order. The simultors protocol options are NOP,SACK PERMITTED, TIMESTAMP, NOP,WINDOW SCALE while mine are in a different order. I dont know to change the order, and I cant find much information about SACK PERMITTED. seems to be a default. I am programming with Visual Studio 2008 and a windows 7 computer. Any help will be appreciated.



What am I doing wrong? Please help.

Thanks
Jobin Thomas