客户端-服务器远程连接
问题描述:
请大家好,我是TCP(套接字)编程的新手.我只是尝试同步套接字,但我不知道远程客户端计算机将如何连接到我的主机服务器.它是桌面应用程序,而不是基于网络的应用程序.请我需要有人帮助我完成与该主机的远程客户端连接.
pls guys, i''m new to TCP (socket) programming. i''m just trying out synchronous sockets but i don''t know how the remote client computers would connect to my host server. its a desktop apps not a web based apps. pls i need someone to put me through what i hav to do to achieve this remote client connection to this host computer.
答
从客户端角度来看,这确实是简单;所有您需要做的就是连接.听起来很简单,很容易.
签出TcpClient.Connect或直接检查以下内容:
Msdn TcpClient ^ ]
干杯,AT
Hi, from the client perspective it is really easy; all you have to do is just connect. Sounds easy and it is easy.
Check out the TcpClient.Connect or simply go over this:
Msdn TcpClient[^]
Cheers, AT
这个问题不够具体,所以我将尝试仅向您提供一般性想法.
可以在不同级别进行联网.对于TCP,我建议不要使用套接字,而应该使用TcpListener/TcpClient
.我尝试在过去的答案中概述这些级别:
我如何将byte []发送到另一台PC [ ^ ],
在局域网上与两个Windows应用程序进行通信. [^ ].
另请参见来自同一端口号的多个客户端 [ ^ ]体系结构和线程.
您需要了解的第一件事是线程.—SA
The question is not specific enough, so I''ll try to give you only the general ideas.
Networking can be done in different levels. With TCP, I would recommend working not with sockets, but rather withTcpListener/TcpClient
. I tried to overview those levels in my past answers:
how i can send byte[] to other pc[^],
Communication b/w two Windows applications on LAN.[^].
See also Multple clients from same port Number[^] for general architecture and threading.
First thing you need to understand well is threading.—SA