Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Socket Programming on a single computer?

Tags:

c#

.net

sockets

I am building a client-server chat application.

It has both a server and a client part.

Is it possible to test the application on the same machine or do i need really need two different computer to run the application.

like image 328
Some Body Avatar asked Sep 12 '12 14:09

Some Body


3 Answers

Yes, it is possible to test your application on same machine.

IP Address of both client and server in this case would be same. Just open different ports for client and server.

like image 109
Haris Hasan Avatar answered Oct 14 '22 05:10

Haris Hasan


Yes, it's possible.

  • Start your server up and it will listen to a specific port(The server application either has defined one or you have to provide one to it).

  • Start the client application and make it connect to your machine (127.0.0.1) with the port number your server application listens to.

You may have to modify the application to change the IP address or port number if the program you have does not provide you command line options to specify them.

like image 24
daye.zhang Avatar answered Oct 14 '22 05:10

daye.zhang


You can test on the same machine. I am doing this right now as I type this note. :)

Of course normal things you would expect apply...you can't test two listeners on the same port which are on the same interface, for example. But a client connecting to a server on the same box should work no problem.

And of course before you release you should test on different machines as well. This could expose bugs that a single box config does not.

like image 31
Eric Fleischman Avatar answered Oct 14 '22 06:10

Eric Fleischman