C#.net套接字编程代码 [英] C#.net socket programming code
问题描述
hi
我正在从事C#.net套接字编程
其中我有2个程序客户端和服务器
在收到客户端的用户名后在我的应用程序中
服务器向客户端发送消息
但是为此,我每次必须静态插入客户端IP地址
在服务器程序代码中用于发送消息,因此对于不同的客户端计算机,我需要更改服务器代码
有什么办法可以获取在服务器代码本身内部将用户名动态发送到我的服务器的客户端IP地址.
如果有人有此代码,请提供帮助.
在此先感谢.
Sunit Parmar
hi
I am working on C#.net socket programming
in which i have 2 programs client and server
in my application after receiving username from client
server sends a message to client
but for that each time i have to insert clients IP address statically
in server program code for sending message so for diffrent client machines i need to change server code
is there any way to get clients IP address who sends username to my server inside server code itself dynamically.
please help if anyone have code for this.
thanks in advance.
Sunit Parmar
推荐答案
关于该主题的我的文章可能对您有用.绝对有可能,您应该查看Socket.RemoteEndPoint(我认为这就是所谓的; P)
看看这些:
快速网络库2 [网络游戏的类和功能 [
My articles on this topic may be of use to you. It is definitely possible and you should look at Socket.RemoteEndPoint (i think that''s what it''s called ;P)
Have a look at these:
Fast Networking Library 2[^]
Network gaming classes and functions[^]
They provide exactly what your looking for (and may saver you the effort of writing a lot of networking code ;P)
这篇关于C#.net套接字编程代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!