Click here to Skip to main content
Email Password   helpLost your password?

Introduction

The power of network programming in .NET platform cannot be denied. Socket programming is the core of network programming in Windows and Linux, and today the .NET platform implements it in a powerful way. In this article, we will see the basics of socket programming in C#. To be precise, I have created a command client and a command server, to communicate between a remote server and up to 200 clients and send the specified commands to them. As a sample application, I have created a chat client application that uses this command client/server to implement chat functions. Before I start explaining my application, let me give you a small introduction on network programming and sockets taken from the book 'C# network programming', written by Richard Blum.

Sockets

In socket-based network programming, you don't directly access the network interface device to send and receive packets. Instead, an intermediary connector is created to handle the programming interface to the network. Assume that a socket is a connector that connects your application to a network interface of your computer. For sending and receiving data to and from the network you should call the socket's methods.

Socket programming in C#

The 'System.Net.Sockets' namespace contains the classes that provide the actual .NET interface to the low-level Winsock APIs. In network programming, apart from which programming language to use there are some common concepts like the IP address and port. IP address is a unique identifier of a computer on a network and port is like a gate through which applications communicate with each other. In brief, when we want to communicate with a remote computer or a device over the network, we should know its IP address. Then, we must open a gate (Port) to that IP and then send and receive the required data.

IP addresses in C#

One of the biggest advantages you will notice in the .NET network library is the way IP address/port pairs are handled. It is a fairly straightforward process that presents a welcome improvement over the old, confusing UNIX way. .NET defines two classes in the System.Net namespace to handle various types of IP address information:

IPAddress

An IPAddress object is used to represent a single IP address. This value is then used in various socket methods to represent the IP address. The default constructor for IPAddress is as follows:

public IPAddress(long address)

The default constructor takes a long value and converts it to an IPAddress value. In practice, the default is almost never used. Instead, several methods in the IPAddress class can be used to create and manipulate IP addresses. The Parse() method is often used to create IPAddress instances:

IPAddress newaddress = IPAddress.Parse("192.168.1.1");

IPEndPoint

The .NET Framework uses the IPEndPoint object to represent a specific IP address/port combination. An IPEndPoint object is used when binding sockets to local addresses, or when connecting sockets to remote addresses.

Connection-oriented and connectionless sockets

The world of IP connectivity revolves around two types of communication: connection-oriented and connectionless. In a connection-oriented socket, the TCP protocol is used to establish a session (connection) between two IP address endpoints. There is a fair amount of overhead involved with establishing the connection, but once it is established, the data can be reliably transferred between the devices.

Connectionless sockets use the UDP protocol. Because of that no connection information is required to be sent between the network devices and it is often difficult to determine which device is acting as a "server", and which is acting as a "client". We will focus on the first type of socket programming in this article.

Using connection-oriented sockets

In the .NET Framework, you can create connection-oriented communications with remote hosts across a network. To create a connection-oriented socket, separate sequences of functions must be used for server programs and client programs:

Server

You have four tasks to perform before a server can transfer data with a client connection:

  1. Create a socket.
  2. Bind the socket to a local IPEndPoint.
  3. Place the socket in listen mode.
  4. Accept an incoming connection on the socket.

Creating the server

The first step to constructing a TCP server is to create an instance of the Socket object. The other three functions necessary for successful server operations are then accomplished by using the methods of Socket object. The following C# code snippet includes these steps:

IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, 8000);
Socket newsock = Socket(AddressFamily.InterNetwork,
                   SocketType.Stream, ProtocolType.Tcp);
newsock.Bind(localEndPoint);
newsock.Listen(10);
Socket client = newsock.Accept();

The Socket object created by the Accept() method can now be used to transmit data in either direction between the server and the remote client.

Client

Now that you have a working TCP server, you can create a simple TCP client program to interact with it. There are only two steps required to connect a client program to a TCP server:

  1. Create a socket.
  2. Connect the socket to the remote server address.

Creating the client

As it was for the server program, the first step for creating the client program is to create a Socket object. The Socket object is used by the socket Connect() method to connect the socket to a remote host:

IPEndPoint ipep = 
    new IPEndPoint(Ipaddress.Parse("127.0.0.1"), 8000);
Socket server = new Socket(AddressFamily.InterNetwork,
                  SocketType.Stream, ProtocolType.Tcp);
server.Connect(ipep);

This example attempts to connect the socket to the server located at address 127.0.0.1.This is the IP address of the local host (current computer) and is a loopback IP for testing a network application without a network. Of course, you can also use hostnames along with the Dns.Resolve() method in a real network. (Dns is in System.Net namespace). Once the remote server TCP program accepts the connection request, the client program is ready to transmit data with the server using the standard Send() and Receive() methods.

Blocking problem of network applications

Sockets are in blocking mode by default. In this mode they will wait forever to complete their functions, holding up other functions within the application program until they are complete. Many programs can work quite competently in this mode, but for applications that work in the Windows programming environment, this can be a problem. There are some ways to solve this problem. The first thing that comes to a programmer's mind is multi threading. I chose this solution in my application too. This is a simple way when compared to asynchronous network programming or the old 'Non-Blocking sockets' way.

Our command client/server

After a brief introduction on network programming in C#, I should give you more details about our command client/server application here. Of course, I can't write a book on network programming in this little article. This is only an introduction to network programming. You can find many samples and tutorials on MSDN and CodeProject explaining this concept in detail.

About the command server

The server application is a console program. After starting, it will bind to the '127.0.0.1' local IP and wait on the port 8000 by default for clients. You can pass the IP and the port of the server as the first and second command line parameters when starting the server, if you have a real network. For example: c:\> ConsoleServer 192.198.0.100 8960.

I used BackgroundWorker to implement multithreading in time consuming functions in the server and client. One of these actions includes the acceptance part of the server:

bwListener = new BackgroundWorker();
bwListener.DoWork += new DoWorkEventHandler(StartToListen);
bwListener.RunWorkerAsync();

private void StartToListen(object sender , DoWorkEventArgs e)
{
   this.listenerSocket = new Socket(AddressFamily.InterNetwork, 
                           SocketType.Stream, ProtocolType.Tcp);
   this.listenerSocket.Bind(
               new IPEndPoint(this.serverIP , this.serverPort));
   this.listenerSocket.Listen(200);
   while ( true )
      this.CreateNewClientManager(this.listenerSocket.Accept());
}

I have a class named ClientManager. When the server is connected to a remote client it passes the communication socket to this class and adds this new ClientManager object to a list of current connected remote clients. Each ClientManager object in the list is responsible for communicating with its remote client. The ClientManager object announces the server with various events defined in this class when an action takes place between the remote client and the server. These events are:

public event CommandReceivedEventHandler CommandReceived;

Occurs when a command is received from a remote client.

public event CommandSentEventHandler CommandSent;

Occurs when a command had been sent to the remote client successfully.

public event CommandSendingFailedEventHandler CommandFailed;

Occurs when a command sending action fails. This is may be because of disconnection or sending exception.

public event DisconnectedEventHandler Disconnected;

Occurs when a client is disconnected from this server.

Sending and receiving data

Since we have a command client/server application we should have a command object to send and receive data. This is implemented in a 'Command' class. This class is the same in client and server. When the server wants to send a command to the client it builds a Command object and then sends it to the client and vice versa.

The command class is good for the user of this code. But in the network, we can't send and receive an object or a type. Everything should be converted to byte array. So, we should convert this object to a byte array part by part and send or receive it over the network in real Send and Receive functions inside our code. The following code shows the send command method. 'cmd' is the command that we want to send to the remote client:

//Type

byte [] buffer = new byte [4];
buffer = BitConverter.GetBytes((int)cmd.CommandType);
this.networkStream.Write(buffer , 0 , 4);
this.networkStream.Flush();

//Sender IP

byte [] senderIPBuffer = 
     Encoding.ASCII.GetBytes(cmd.SenderIP.ToString());
buffer = new byte [4];
buffer = BitConverter.GetBytes(senderIPBuffer.Length);
this.networkStream.Write(buffer , 0 , 4);
this.networkStream.Flush();
this.networkStream.Write(senderIPBuffer, 0, 
                               senderIPBuffer.Length);
this.networkStream.Flush();
                
//Sender Name

byte [] senderNameBuffer = 
   Encoding.Unicode.GetBytes(cmd.SenderName.ToString());
buffer = new byte [4];
buffer = BitConverter.GetBytes(senderNameBuffer.Length);
this.networkStream.Write(buffer , 0 , 4);
this.networkStream.Flush();
this.networkStream.Write(senderNameBuffer, 0, 
                               senderNameBuffer.Length);
this.networkStream.Flush();
                
//Target

byte [] ipBuffer = 
  Encoding.ASCII.GetBytes(cmd.Target.ToString());
buffer = new byte [4];
buffer = BitConverter.GetBytes(ipBuffer.Length);
this.networkStream.Write(buffer , 0 , 4);
this.networkStream.Flush();
this.networkStream.Write(ipBuffer , 0 , ipBuffer.Length);
this.networkStream.Flush();

//Meta Data.

if ( cmd.MetaData == null || cmd.MetaData == "" )
    cmd.MetaData = "\n";

byte [] metaBuffer = 
          Encoding.Unicode.GetBytes(cmd.MetaData);
buffer = new byte [4];
buffer = BitConverter.GetBytes(metaBuffer.Length);
this.networkStream.Write(buffer , 0 , 4);
this.networkStream.Flush();
this.networkStream.Write(metaBuffer, 0, metaBuffer.Length);
this.networkStream.Flush();

The send and receive are bidirectional operations. For example, when we send 4 bytes to the client, the client should read the 4 bytes. We should repeat this operation until all the sent data is read. See the receive code of the client here:

while ( this.clientSocket.Connected )
{
    //Read the command's Type.

    byte [] buffer = new byte [4];
    int readBytes = this.networkStream.Read(buffer , 0 , 4);
    if ( readBytes == 0 )
      break;
    CommandType cmdType = 
         (CommandType)( BitConverter.ToInt32(buffer , 0) );
    
    //Read the command's sender ip size.

    buffer = new byte [4];
    readBytes = this.networkStream.Read(buffer , 0 , 4);
    if ( readBytes == 0 )
    break;
    int senderIPSize = BitConverter.ToInt32(buffer , 0);
    
    //Read the command's sender ip.

    buffer = new byte [senderIPSize];
    readBytes = 
        this.networkStream.Read(buffer , 0 , senderIPSize);
    if ( readBytes == 0 )
      break;
    IPAddress senderIP = IPAddress.Parse(
             System.Text.Encoding.ASCII.GetString(buffer));
    
    //Read the command's sender name size.

    buffer = new byte [4];
    readBytes = this.networkStream.Read(buffer , 0 , 4);
    if ( readBytes == 0 )
      break;
    int senderNameSize = BitConverter.ToInt32(buffer , 0);
    
    //Read the command's sender name.

    buffer = new byte [senderNameSize];
    readBytes = this.networkStream.Read(buffer, 0, senderNameSize);
    if ( readBytes == 0 )
      break;
    string senderName = 
        System.Text.Encoding.Unicode.GetString(buffer);
    
    //Read the command's target size.

    string cmdTarget = "";
    buffer = new byte [4];
    readBytes = this.networkStream.Read(buffer , 0 , 4);
    if ( readBytes == 0 )
       break;
    int ipSize = BitConverter.ToInt32(buffer , 0);
    
    //Read the command's target.

    buffer = new byte [ipSize];
    readBytes = this.networkStream.Read(buffer , 0 , ipSize);
    if ( readBytes == 0 )
      break;
    cmdTarget = System.Text.Encoding.ASCII.GetString(buffer);
    
    //Read the command's MetaData size.

    string cmdMetaData = "";
    buffer = new byte [4];
    readBytes = this.networkStream.Read(buffer , 0 , 4);
    if ( readBytes == 0 )
      break;
    int metaDataSize = BitConverter.ToInt32(buffer , 0);
    
    //Read the command's Meta data.

    buffer = new byte [metaDataSize];
    readBytes = this.networkStream.Read(buffer , 0 , metaDataSize);
    if ( readBytes == 0 )
         break;
    cmdMetaData = System.Text.Encoding.Unicode.GetString(buffer);
                  
    Command cmd = new Command(cmdType, 
                        IPAddress.Parse(cmdTarget), cmdMetaData);
    cmd.SenderIP = senderIP;
    cmd.SenderName = senderName;
    this.OnCommandReceived(new CommandEventArgs(cmd));
    }
    this.OnServerDisconnected(new ServerEventArgs(this.clientSocket));
    this.Disconnect();
}

About the command client

The command client is very similar to the server. Everything is in the 'CommandClient' class. Since our application is an event driven program this class also has some events to announce the user of the occurred actions. Here is a brief definition of these events:

public event CommandReceivedEventHandler CommandReceived;

Occurs when a command is received from a remote client.

public event CommandSentEventHandler CommandSent;

Occurs when a command has been sent to the remote server successfully.

public event CommandSendingFailedEventHandler CommandFailed;

Occurs when a command sending action fails. This is because of disconnection or sending exception.

public event ServerDisconnectedEventHandler ServerDisconnected;

Occurs when the client is disconnected.

public event DisconnectedEventHandler DisconnectedFromServer;

Occurs when this client is disconnected from the remote server.

public event ConnectingSuccessedEventHandler ConnectingSuccessed;

Occurs when this client is connected to the remote server successfully.

public event ConnectingFailedEventHandler ConnectingFailed;

Occurs when this client fails on connecting to the server.

public event NetworkDeadEventHandler NetworkDead;

Occurs when the network fails.

public event NetworkAlivedEventHandler NetworkAlived;

Occurs when the network starts to work.

Conclusion

In this application, you can find the following concepts of .NET programming:

And many other .NET programming concepts that I couldn't explain in detail here. The code is fully XML commented and very clear to understand. Please contact me if there is any ambiguous point or you need any help on my code.

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralA blocking operation was interrupted by a call to WSACancelBlockingCall [modified]
christine sarsonas
16:23 15 Jan '10  
Good day to all..

I encounter this exception (A blocking operation was interrupted by a call to WSACancelBlockingCall) after pressing enter key to disconnect the server.

Do i need to tweak some codes to fix the problem?

modified on Saturday, January 16, 2010 9:45 AM

GeneralExternal IP [modified]
rajni pal
2:29 15 Jan '10  
hi sir,
how do i make the client connection open till that client sending a message? As, my server is on External IP.there 's no chatting happening on my local ip's client's.not even all online users can seen to each other

modified on Friday, January 15, 2010 8:25 AM

Generalhow to write server side for a tcp sender device (as client side)
fa-ha
7:46 7 Dec '09  
hi all
in my web app i have a device that sends tcp packets through gprs.device sends tcp packets alternatively to server and through special port.i want to listen to that port to receive tcp packets.i mean i don't have any client app and the client is only a device that sends data(each packet includes some nmea data).
i realy need your help,plz tell me how should i write server side(while there is no client side)
regards
Generalشبکه
omar1388
3:37 29 Sep '09  
با سلام
من در کار با شبکه مشکل دارم می خواستم ببینم که آیا شما می توانید بنده را یاری رسانید.

1)در پیدا کردن لیست کلاینت های متصل از طریق شبکه
2) connect در
3) ارسال متن یا فایل به کلاینت ها یا از کامپیوتری به کامپیوتر دیگر
و....
با تشکر
GeneralHow can I send Picture with this application?
phata4u
2:01 15 Sep '09  
I coverted my picture to a byte array and send to server but seem like it don't receive.

this i my send pic method
private void SendPic()
{
byte[] a = imageToByteArray(picImg.Image);
string str;
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
str = enc.GetString(a);
if (this.client.Connected && a!=null)
{
//this.txtMessages.Text += this.client.NetworkName + ": " + this.txtNewMessage.Text.Trim() + Environment.NewLine;
//this.txtNewMessage.Text = "";
//this.txtNewMessage.Focus();
this.client.SendCommand(new Proshot.CommandClient.Command(Proshot.CommandClient.CommandType.Image, IPAddress.Broadcast, str));

}
}


I modify the source to add a commandtype image to relize when to send text when to send image.
and I modified this method. when client receive a Image CommandType it will convert from metadata to picture and assign to picturebox.
void client_CommandReceived(object sender , CommandEventArgs e)
{
switch(e.Command.CommandType)
{
case(CommandType.Message):
if (e.Command.Target.Equals(IPAddress.Broadcast))
{
this.txtMessages.Text += e.Command.SenderName + ": " + e.Command.MetaData + Environment.NewLine;
//System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
//byte[] bytearr = encoding.GetBytes(e.Command.MetaData);
//this.picImg.Image = byteArrayToImage(bytearr);
}
else if (!this.IsPrivateWindowOpened(e.Command.SenderName))
{
this.OpenPrivateWindow(e.Command.SenderIP, e.Command.SenderName, e.Command.MetaData);
//ShareUtils.PlaySound(ShareUtils.SoundType.NewMessageWithPow);
}
break;
case (CommandType.Image):
if (e.Command.Target.Equals(IPAddress.Broadcast))
{
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
byte[] bytearr = encoding.GetBytes(e.Command.MetaData);
this.picImg.Image = byteArrayToImage(bytearr);
}
break;


Someone Help please!
GeneralIPAddress.Parse
maxrpgg
21:13 22 Aug '09  
hi xironix


may i ask a question please. in the frmMain we have these 2 pieces of code:

this one near the top
<pre>this.client = new Proshot.CommandClient.CMDClient(IPAddress.Parse("127.0.0.1"), 8000, "None");</pre>

and this one in mniEnter_click
<pre>frmLogin dlg = new frmLogin(IPAddress.Parse("127.0.0.1"), 8000);</pre>

do both of these need to point to the server/host address?

and why is there 2 of them please?.

Thank you so much.
GeneralHow to integrate with Asp.net?
ajay_zenta
2:52 13 Aug '09  
Article is excellent. I want to integrate with web (Asp.net with c#). Please give me the steps to implement in my project. Please help me urgently.
GeneralSome One please help ME
bobby_u13
18:13 23 Jul '09  
hi xironix & Everyone

im an Electronic Engineering Student very new to Programing,i had to devlop an application for communication between robots connected to Server through TCP/IP protocals,where this TCP/IP Chat Application Using C# is very pretty close to my requirement but the problem is when i execute the .exe file or src file using VB 2008 its showning

server listening on *** Listening on port 0.0.0.0:8000 started.Press ENTER to shutdown server. ***

i understood that server is listening at ip address "0.0.0.0" and port "8000"

how to channge the ip address ???
Do i need to enter the server ip address in client application inorder make Client and Server communicate ???
a little more documentation would be more helpfull for newbie like me.
expecting reply asap Smile

Thanks in advance Smile
GeneralRe: Some One please help ME [modified]
xironix
21:08 23 Jul '09  
Dear Bobby,

This is quite simple. You have two options to gain that. The first option is to run ConsoleServer with optional arguments in command prompt. Here is the syntax of calling ConsoleServer application:

ConsoleServer [IP] [Port]
eg. ConsoleServer 192.168.1.10 8002

The second option is to change the default port and IP in source code. To achieve this, you have to change the value of 'serverPort' and 'serverIP' variables in 'Program.cs' code file of ConsoleServer project.

You also need to define this information for client. Look at the following code:



public CMDClient(IPEndPoint server,string netName)
{
this.serverEP = server;
this.networkName = netName;
System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged += new System.Net.NetworkInformation.NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged);
}

public CMDClient(IPAddress serverIP , int port,string netName)
{
this.serverEP = new IPEndPoint(serverIP , port);
this.networkName = netName;
System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged += new System.Net.NetworkInformation.NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged);
}



These are two constructors of 'CommandClient' class. You have two pass the two arguments, Port and IP, in main form of 'ChatClient':



public frmMain()
{
InitializeComponent();
this.privateWindowsList = new List<frmPrivate>();
this.client = new Proshot.CommandClient.CMDClient(IPAddress.Parse("[Your IP Address]") , [Your Port Number],"None");
}



You can find this constructor in 'frmMain' code file of 'ChatClient' project.

Regards,
XironiX Smile

[ _ Always there is another way _ ]

modified on Friday, July 24, 2009 2:22 AM

GeneralRe: Some One please help ME
bobby_u13
12:30 27 Jul '09  
hi xironix

u rock tannx alot

small video demo would be more helpfull n clear most of our doubts


Tannx alot Smile
GeneralRe: Some One please help ME
Mike Diack
2:01 12 Aug '09  
So you might typically start it via:

ConsoleServer 127.0.0.1 8000

I've given it a try for testing out loopback stuff. This looks excellent!

Thanks for all of your efforts.

Mike
GeneralNice Program But Please Till Me How To Send Files
tarek_fcis
2:26 7 Jul '09  
Nice Program But Please Till Me How To Send Files
Generalupdate to VS 2008
crzyone9584
18:39 17 Jun '09  
I have VS 2008. I used the upgrade tool that comes with it to convert it. WHen i try the debug i get this error

A project with an Output of Class Library cannot be started directly.

In order to debug this project, add an executable project to this solution which references the library project. Set the ecevutable project as the start-up project.

WHat is ment by this?
GeneralRe: update to VS 2008
mafaz321
5:15 21 Jul '09  
Set the startup project to where the Form is
GeneralI wanna implement your APP on a single computer.
Crest Dubua
1:38 4 May '09  
I copyed your sourceCODE....now I opened the FrmMain[Publc Room] and I started the Server Console[] !
[I turned off my Firewall]

When write a message....[& I press send] NOTHING happens.
What is that I am missing ??

Thanks

P.S.
Be aware that I never tried a chat application before.
Shall I start some other form at the same time ??
What is the order of things to be started.
Step By Step please ..

For instance:
1)Connect to a Network
2)Open port 8000
3)switch off Firewall.
4) start Console App
5) start FrmMain
6) write a message in TextBox.
7) send it. Big Grin


I am sure I am missing something .

HELP please !
GeneralRe: I wanna implement your APP on a single computer.
tarring
16:47 2 Nov '09  
I think you maybe forget to login..
GeneralI try the demo . . it did not work . . could you please tell me whats the problem . .
yayi88
12:16 17 Apr '09  
I then download the source code . . and compile it again, still it cannot work . . can u please help me . . when i run the server it says 0.0.0.0:8000

and the client when i run on the same machine, it doesnt connected to the server . .
GeneralRe: I try the demo . . it did not work . . could you please tell me whats the problem . .
yayi88
12:18 17 Apr '09  
i already disable my firewall and so on . .
Generalserver is not accessible (plz help me)
Ankit_student
16:51 14 Apr '09  
very good application.

but sir when i put client.exe on client computer and the server.exe in the server.
it give s by the popup message that server is not accesible. what we should do?
where in code we changes the server ip,and the client ip to connect these application in a network.

plz help me....... Smile
AnswerRe: server is not accessible (plz help me)
xironix
18:14 14 Apr '09  
Dear Friend,

Now we are using this application in our network with no problem.Setting the IP address of remote server is completely straightforward. You have a property named ServerIP in CMDClient class.Just change this property in the code.If you could't connect, check your firewall and network security configuration.

Cheers

[ _ Always there is another way _ ]

General[Message Deleted]
it.ragester
22:46 2 Apr '09  
[Message Deleted]
GeneralConnect/disconnect problems
Anders Visconti
3:29 31 Mar '09  
Now that I've distributed the program across multiple computers in the network, i'm finding it has many problems keeping connections. Some users will logon and see everyone, others only see a handful of the users. Many disconnects are not being registered on the server, so they can't reconnect at all. And in some cases you can see all users attached but messages don't get to anyone, even though I can see messages from everyone else.
I've barely modified the code and have only made aesthetic changes. Any idea why this is so unreliable? :(
General?finding a open port
elhebrahimi
21:29 16 Mar '09  
Dear Xironx
How can I find a open port on a host.I use netstat but it didn't help.If I have a valid IP address and wanna to connect it through internet will I need to develope a web application or windows application that listen to a port?As I 'm a beginner in Socket programing wich refrences do you recommend to read?persian and english.
best wishes.
GeneralCan't move server
Anders Visconti
8:46 5 Mar '09  
First let me say this is probably the most solid tcp/ip socket app i've seen. Never an unwanted disconnect or socket exception. And thats after converting to VC# Express. Excellent job.

The only problem I'm having right now is very perplexing. I am working on the code to both client and server on my machine. I can run the server from here and connect with clients from other systems. However I cannot move the server to any other computer, else no connection. I have been through all of the IP references in here and I don't see where the clients are instructed to look for the server. I even forced a different IP into the client, ran it from another machine and it still connected to the server on my computer.

Love that it works so well. Hate that I can't see how..

Help me out, i'd really like to get the server in it's permanent home.

Thanks
AnswerRe: Can't move server
xironix
22:50 6 Mar '09  
Dear Anders,

Thank you for your comment. I think connecting the parties is completely straightforward. If you set the IPAddress and Port numbers on both sides correctly, there is nothing strange to do.You have done it! I suppose your problem is about your network configuration if you just have problem when you wanna communicate remotely. Turn the Firewall off and check it again.Sorry if I couldn't get your problem truly.Please don't hesitate if you need more help.

Regards

[ _ Always there is another way _ ]


Last Updated 31 Jan 2006 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2010