Resolved How to get client's IP address and port in UDP Echo server?

Kamen

Active member
Joined
Nov 30, 2020
Messages
28
Programming Experience
1-3
Hello, everyone.
I have some problems in customizing UDP Echo server.
I'm following this guide now.
I want to get client's IP address and port in OnReceived function of UDP Echo Server.
this function has UDPEndpoint param named 'endpoint'.
I think I can get client's info with this param but I can't know correct way to do so.
So I hope you help me asap.
Thank you.
 
Solution
Ah, the irony. CSharpServer is written in C++/CLI. And it's just a thin wrapper around the C++ ASIO library. Unfortunately, when he wrapped the ASIO endpoint, he did not provide any ways to expose the port and IP addressed.

If you want something written truly in C#, use the same author's NetCoreServer instead. There it looks like he uses the standard .NET Core IPEndPoint class from which you can get probably get more information.

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,488
Location
Chesapeake, VA
Programming Experience
10+
Ah, the irony. CSharpServer is written in C++/CLI. And it's just a thin wrapper around the C++ ASIO library. Unfortunately, when he wrapped the ASIO endpoint, he did not provide any ways to expose the port and IP addressed.

If you want something written truly in C#, use the same author's NetCoreServer instead. There it looks like he uses the standard .NET Core IPEndPoint class from which you can get probably get more information.

 
Last edited:
Solution

Kamen

Active member
Joined
Nov 30, 2020
Messages
28
Programming Experience
1-3
Ah, the irony. CSharpServer is written in C++/CLI. And it's just a thin wrapper around the C++ ASIO library. Unfortunately, when he wrapped the ASIO endpoint, he did not provide any ways to expose the port and IP addressed.

If you want something written truly in C#, use the same author's NetCoreServer instead. There it looks like he uses the standard .NET Core IPEndPoint class from which you can get probably get more information.

Great Thank you. You have given big help me like before. I've learned lots from you always.
You are very excellent.
I hope to learn more and more from you in the future.
Thank you again.
 

NoUserHere

Well-known member
Joined
Sep 5, 2018
Messages
2,138
Programming Experience
10+
You are very excellent.
That he is; Skydiver is one of the most talented programmers I've had the privilege of befriending over the last few years. I'm at this years, and I still learn new things from him occasionally.
I hope to learn more and more from you in the future.
You will always learn something from him. I hope he will consider working for my company in a years time. ;)
 
Top Bottom