coldfusion244
Well-known member
Hello everyone,
I am attempting to make a client/server program using sockets, but the program hangs on the Socket.AcceptConnection() line until there is a connection made. I was searching around and found some code on how to do it, but it used neither the AcceptConnection using a listener nor the read.ReadString(). I was wondering if anyone knows of some good tutorials or has some commented socket code laying around. MSDN was a waste of time, since I am new to network programming. I want to have multiple clients connected to the server at one time, and be able to send information back and forth. Not looking for many clients, max will probably be 50, if that.
I was using the following code:
[CS]
private void wfc()
{
TcpListener listener;
try
{
while(true)
{
listener = new TcpListener(50000);
listener.Start();
connection = listener.AcceptSocket();
clsClient CC = new clsClient(connection, this.t1);
listener.Stop();
listener = null;
}
}
catch(Exception e)
{
t1.Text = e.ToString();
}
}
[/CS]
Thanks,
-Cold
I am attempting to make a client/server program using sockets, but the program hangs on the Socket.AcceptConnection() line until there is a connection made. I was searching around and found some code on how to do it, but it used neither the AcceptConnection using a listener nor the read.ReadString(). I was wondering if anyone knows of some good tutorials or has some commented socket code laying around. MSDN was a waste of time, since I am new to network programming. I want to have multiple clients connected to the server at one time, and be able to send information back and forth. Not looking for many clients, max will probably be 50, if that.
I was using the following code:
[CS]
private void wfc()
{
TcpListener listener;
try
{
while(true)
{
listener = new TcpListener(50000);
listener.Start();
connection = listener.AcceptSocket();
clsClient CC = new clsClient(connection, this.t1);
listener.Stop();
listener = null;
}
}
catch(Exception e)
{
t1.Text = e.ToString();
}
}
[/CS]
Thanks,
-Cold