简体   繁体   中英

TCP/IP server/client multiconnection using C# and receiving public ip address of client

I need to write an application using C#, which will connect a client to a server with a static IP address.

The server and clients must be able to send and receive message at the same time. Also, I need to log the information with respect of clients public address as well.

How can I make it using C#?

Shall I use TcpListener / TcpClient or is there any other method which can make multiple connections?

If you really want to go low level to TCP/IP and own message parse/serialize/deserialize, you can use SocketAsyncEventArgs for high performance code, but it is not as easy as with TCPListener/TCPClient.

http://msdn.microsoft.com/en-us/library/vstudio/system.net.sockets.socketasynceventargs

http://www.codeproject.com/Articles/83102/C-SocketAsyncEventArgs-High-Performance-Socket-Cod

Question is, why not to use for example WCF/IIS ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM