fuadhamidov
Programmer
hi
i am new to c# and also socket programming. we have developed a small chat program. it connects to localhost. while we try to connect to remote machine with IP+port it doesn't connect.
our program listen from any defined port. and the other part begin to send message to given IP+port
...
//ipLocalEndPoint is IP+port; (127.0.0.1:3000)
//nSoc = 0;
SocClient[nSoc].AsyConnectTCIP(ipLocalEndPoint);
//it calls following method (AsyConnectTCIP)
...
//public Socket Soc;
public void AsyConnectTCIP(EndPoint remoteEP)
{
this.remoteEP =remoteEP;
AsyncCallback beginConnectCallback = new AsyncCallback(ConnectCallBack);
Soc.BeginConnect(remoteEP,beginConnectCallback,Soc);
//it doesn't connect to remote IP+port and goes following mehtod (OnCloseRemote)
}
...
public event CloseDelegate OnConnectClose;
...
// not important. it prints error message
private void OnCloseRemote(object sender, SockEventArgs e)
{
label1.Text = "Remote Close";
nClose +=1;
//txtClose.Text = nClose.ToString();
foreach (ListViewItem aa in listView1.Items)
{
if (aa.Text == e.SocketRef.ToString())
{
listView1.Items.Remove(aa);
break;
}
}
}
i am new to c# and also socket programming. we have developed a small chat program. it connects to localhost. while we try to connect to remote machine with IP+port it doesn't connect.
our program listen from any defined port. and the other part begin to send message to given IP+port
...
//ipLocalEndPoint is IP+port; (127.0.0.1:3000)
//nSoc = 0;
SocClient[nSoc].AsyConnectTCIP(ipLocalEndPoint);
//it calls following method (AsyConnectTCIP)
...
//public Socket Soc;
public void AsyConnectTCIP(EndPoint remoteEP)
{
this.remoteEP =remoteEP;
AsyncCallback beginConnectCallback = new AsyncCallback(ConnectCallBack);
Soc.BeginConnect(remoteEP,beginConnectCallback,Soc);
//it doesn't connect to remote IP+port and goes following mehtod (OnCloseRemote)
}
...
public event CloseDelegate OnConnectClose;
...
// not important. it prints error message
private void OnCloseRemote(object sender, SockEventArgs e)
{
label1.Text = "Remote Close";
nClose +=1;
//txtClose.Text = nClose.ToString();
foreach (ListViewItem aa in listView1.Items)
{
if (aa.Text == e.SocketRef.ToString())
{
listView1.Items.Remove(aa);
break;
}
}
}