LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Testing a socket app (https://www.linuxquestions.org/questions/programming-9/testing-a-socket-app-19978/)

ChimpFace9000 05-01-2002 09:41 PM

Testing a socket app
 
I wrote an app that uses sockets. It recv's strings, and depending on the string, it performs an action. Ill eventually write a client to send the strings, but id like to test it right now. I thought i could do this with telnet, but couldnt figure it out. Is there some program that will let me connect to my server and send strings? Or will telnet do this?

Mik 05-02-2002 07:23 AM

Yes telnet will work fine for that:
telnet hostname portnumber

The hostname can usually be localhost, and the portnumber is the number you told your server to listen on.

Just another thing. The above is only true if you are using stream sockets (TCP/IP) in your application. If you are using datagram (UDP/IP) or other type of sockets then it won't work with telnet.

ChimpFace9000 05-02-2002 10:58 AM

Well i knew that. I just couldnt figure out how to send a string. I thought something like "send "hello"", but i just get errors.

Mik 05-02-2002 03:03 PM

Well if you are getting errors then there must be something wrong with your program then. Once you are connected with telnet everything you type will get sent directly to the server side.
Don't need to type any specific commands.

What kind of errors are you getting though?

ChimpFace9000 05-02-2002 03:07 PM

When i connect, it lets me type stuff, but all it doesnt do anything.

lucianomx 05-02-2002 03:39 PM

Well, telnet is perfect for this situation, mainly if your server app receive strings, because telnet faithfully sends each byte you type to server and show each byte received from server on screen.

Rather than, if your app expect a especific format of commands, telnet maybe no work properly, because you will have dificulty to type binary data.

Luciano
(Brazil - Sao Paulo/SP )


All times are GMT -5. The time now is 01:24 AM.