This class implements STUN client. Defined in RFC 3489.

C# | Visual Basic | Visual C++ | F# |
public class STUN_Client
Public Class STUN_Client
public ref class STUN_Client
type STUN_Client = class end

All Members | Constructors | Methods | |||
Icon | Member | Description |
---|---|---|
![]() | STUN_Client()()()() | Initializes a new instance of the STUN_Client class |
![]() | Equals(Object) | (Inherited from Object.) |
![]() | Finalize()()()() | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode()()()() | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() ![]() | GetPublicEP(String, Int32, Socket) |
Resolves socket local end point to public end point.
|
![]() ![]() | GetPublicIP(String, Int32, IPAddress) |
Resolves local IP to public IP using STUN.
|
![]() | GetType()()()() | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone()()()() | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() ![]() | Query(String, Int32, IPEndPoint) |
Gets NAT info from STUN server.
|
![]() ![]() | Query(String, Int32, Socket) |
Gets NAT info from STUN server.
|
![]() | ToString()()()() | Returns a string that represents the current object. (Inherited from Object.) |

![]() | |
---|---|
// Create new socket for STUN client. Socket socket = new Socket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp); socket.Bind(new IPEndPoint(IPAddress.Any,0)); // Query STUN server STUN_Result result = STUN_Client.Query("stunserver.org",3478,socket); if(result.NetType != STUN_NetType.UdpBlocked){ // UDP blocked or !!!! bad STUN server } else{ IPEndPoint publicEP = result.PublicEndPoint; // Do your stuff } |

Object | |
![]() | STUN_Client |
Assembly: LumiSoft.Net (Module: LumiSoft.Net.dll) Version: 4.5.5510.19119