TCP client in ardiuno

i am using a software which has a TCP server and it sends data to TCP socket so i want to make a TCP client over the ardiuno side so that i can receive and see the incoming data over the serial console is there any sketch available which can help me to do this thank u !

Did you try the TelnetClient example of the Ethernet library?

As you didn't specify otherwise I expect you to use an Arduino UNO with an original Arduino Ethernet Shield.

sorry for the late reply yes i am using the Ardiuno Uno with original Ardiuno Ethernet Shield

my question is that in the Telnet Client example what should i put in the server ip address as the application which is acting as the TCP server has only one parameter to control and that is the port address and the port address must be the TCP port that will accept the client connections. so the situation is that the application does not have any server address and i assume that the port address of my local network should be used on both the sides. so no idea what to put in the server address in the Telnet Client example so can any one please suggest how to proceed with this problem thank you!

so the situation is that the application does not have any server address and i assume that the port address of my local network should be used on both the sides.

Is that "application" running on your PC? If yes, just enter the IP address of your PC as the server address in the TelnetClient example sketch.

i am using a software which has a TCP server and it sends data to TCP socket

That sounds a bit like you're trying to sniff a TCP connection rather than connecting to a TCP server. Is it possible that you tell us what kind of application you use? Maybe even provide a link to it's web site?

[Is that "application" running on your PC? If yes, just enter the IP address of your PC as the server address in the TelnetClient example sketch. ][/quote] yes the application is running on the same PC i have connected the ardiuno. as u have said i have used the ip address of my PC as the ip address of the server in the telnet client sketch and it seems working.but i am getting some garbage values.and one more thing the port address i have kept as 1900 on both sides i mean both on the ardiuno and in the application which is acting as a TCP server which is the port address of my local area connection.

the below link is the application which is acting as the tcp writer

http://openvibe.inria.fr/documentation/1.2.0/Doc_BoxAlgorithm_TCPWriter.html

the below link is the application which is acting as the tcp writer

http://openvibe.inria.fr/documentation/1.2.0/Doc_BoxAlgorithm_TCPWriter.html

Are you running that application on a Windows or a Linux host?

Did you check that every firewall on that PC is turned off (only during the test!)?

Did you check the application locally? You can do that by running the following command on a command line (given you changed the port to 1900 from the default 5678):

telnet 127.0.0.1 1900

If that connection returns the same garbage you get on the serial Arduino connection, then that's what your software is sending.

thank you pylon for your help, the client and the server are working perfectly now and by the way i am running the application on windows i have another question may be a bit silly the data i am getting is something like "(0x00000000,0x00000381)" and so on and the variable to hold the incoming data is of char type so my question is that is it possible to use this values directly in "if" statement for comparison purpose thank you again

Sorry for the late reply, I was in vacation.

the data i am getting is something like "(0x00000000,0x00000381)" and so on and the variable to hold the incoming data is of char type

As I don't have the source code that generates this the answer is a lot guessing but if the incoming date is of type char, it looks like a string and in this case you have to convert that to an integer first before you can compare. Post your code and I may give you a more precise answer.