Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
rhaibi #1
Member since Jun 2015 · 5 posts
Group memberships: Members
Show profile · Link to this post
Subject: Get Local end point Ip address
Hey Alex, I need to manage the fact that users have multiple ip adresses(WIFI + CABLE) so I'm asking if there's anyway how to get the ip address that the client using to connect to the server
I tracked the sender object in :



  1. private void ClientSocket_OnReceive(object sender, byte[] data, int count)
  2.        {
  3.            if (InvokeRequired)
  4.            {
  5.               // Windows Forms are not Thread Safe, we need to invoke this :(
  6.               // We're not in the UI thread, so we need to call BeginInvoke            
  7.    BeginInvoke(new agsXMPP.Net.ClientSocket.OnSocketDataHandler(ClientSocket_OnReceive), new object[] { sender, data, count });
  8.                 return;
  9.             }

it seems that he have the attribut _socket (but only in the debugging mode) which have the LocalEndPoint that conatians the ip address , the problem that I'm facing is when I try to cast the sender to a System.Net.Sockets.Socket object it triggers an error.
I'm asking on how to get the LocalEndPoint from the sender?

YOUSSEF RHAIBI
Avatar
Alex #2
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you cannot get this on the server. Only code on the client itself could handle this.
If you need this for some reason then you could write your own XMPP extensions which asks a client for the Ip address and send it to the server or another client. This is used in Jingle or file transfers for example in XMPP.

Alex
Avatar
rhaibi #3
Member since Jun 2015 · 5 posts
Group memberships: Members
Show profile · Link to this post
No I don't want to get it on the server, in the client indeed. I just don't know how exactly to do it :-/
I mean how to parse the sender object to get the specific Ip address (because i have multiple
Ip addresses and I don't know which one is used)
 
YOUSSEF RHAIBI
Avatar
Alex #4
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I guess that not possible without modifying the source code and recompile them.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS