Click here to Skip to main content
15,885,876 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a remort TCP device to connect through my System.
Do i need to code for both server side and client side code?
Please help. I am new to this :-)
Posted
Comments
Manas.rn 9-Sep-10 0:21am    
there is a remort device with TCP enabledport.
And i need to send a data packet to it and read a responce from.

In that case do i need to code for both server side and client side?

If yes how?
Manas.rn 9-Sep-10 1:28am    
That device have a IP,and a port known.
And if i send a data through a serial port to that device i can see the response in TCP"telnet".
if i send a data packet to the remort socket i am geting a responce in telnet.
Now do i stll need to write a server app?

Some one help plzzz
Manas.rn 9-Sep-10 2:35am    
The device responds automatically if it get any data.
now my client code is
sendprotocol[18] = 0x03;
sendprotocol[19] = 0x06;
sendprotocol[20] = 0x40;
sendprotocol[21] = 0x00;
sendprotocol[22] = 0x19;
sendprotocol[23] = getchecksum(sendprotocol, 3, 24);
Stream str = client.GetStream();
NetStream = client.GetStream();
NetStream.Write(sendprotocol, 0, sendprotocol.Length);
//str.Write(sendprotocol, 0, sendprotocol.Length);

byte[] recbuffer = new byte[client.ReceiveBufferSize];
NetStream.Read(recbuffer, 0, recbuffer.Length);

is it correct why to send and receive data?

1 solution

That depends on the device and how it communicates. The documentation on the device should explain this, or you may have to look for an SDK for it that the vendor of the device would supply.
 
Share this answer
 
Comments
Manas.rn 9-Sep-10 0:31am    
That device have a IP,and a port known.
And if i send a data through a serial port to that device i can see the response in TCP"telnet".
Manas.rn 9-Sep-10 1:27am    
if i send a data packet to the remort socket i am geting a responce in telnet.
Now do i stll need to write a server app?
Dave Kreskowiak 9-Sep-10 8:08am    
Again, that depends entirely on the device, not your experiment. It cannot denote what gets implemented on your side. Get the documentation on the device and see what it says. Chances are if you can talk to it using Telnet and get the information you want, then you'll be writing a client to do the same thing.
Manas.rn 13-Sep-10 6:57am    
Thanks. What you are saying is correct. However that was not the exact ans i was looking for.
Manas.rn 13-Sep-10 6:58am    
can i use the same port"telnet port" to send and receive data?
or i need to change the port.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900