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?
|
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. |
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.
|
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? |
When i connect, it lets me type stuff, but all it doesnt do anything.
|
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. |