socket程序?
服务器端要把端口设置好,并进行监听:
socketForClinet = tcpListener.AcceptSocket();
try
{
if (socketForClinet.Connected)
{
while (true)
{.......
客户端与服务器端进行连接:
try
{
myclient = new TcpClient(hostname, 8888);
catch (Exception ed)
{
MessageBox.Show(ed.ToString());
return;
}
.....