jeffulot43
Member
- Joined
- Sep 25, 2014
- Messages
- 5
- Programming Experience
- 5-10
Hello All!
I have a function that is doing fine receiving data. I can access the variable that holds the client's i address in the original form, but in an external called function I cannot get that value.
LISTENER:
Private Sub doListen()
Dim incomingClient As System.Net.Sockets.TcpClient
Do
incomingClient = listener.AcceptTcpClient 'Accept the incoming connection. This is a blocking method so execution will halt here until someone tries to connect.
Dim connClient As New ConnectedClient(incomingClient, Me) 'Create a new instance of ConnectedClient (check its constructor to see whats happening now).
AddHandler connClient.dataReceived, AddressOf Me.messageReceived
clients.Add(connClient) 'Adds the connected client to the list of connected clients.
Loop
End Sub
Private Sub messageReceived(ByVal sender As ConnectedClient, ByVal message As String)
'MsgBox(ipaddr)
End Sub
I need to know how to access the ip address value here, and I need to capture the MAC address as well if I can.
Any help is greatly appreciated!
J
I have a function that is doing fine receiving data. I can access the variable that holds the client's i address in the original form, but in an external called function I cannot get that value.
LISTENER:
Private Sub doListen()
Dim incomingClient As System.Net.Sockets.TcpClient
Do
incomingClient = listener.AcceptTcpClient 'Accept the incoming connection. This is a blocking method so execution will halt here until someone tries to connect.
'works here
Dim ipAddr As String = (IPAddress.Parse(CType(incomingClient.Client.RemoteEndPoint, IPEndPoint).Address.ToString())).ToString()
Dim connClient As New ConnectedClient(incomingClient, Me) 'Create a new instance of ConnectedClient (check its constructor to see whats happening now).
AddHandler connClient.dataReceived, AddressOf Me.messageReceived
clients.Add(connClient) 'Adds the connected client to the list of connected clients.
Loop
End Sub
Private Sub messageReceived(ByVal sender As ConnectedClient, ByVal message As String)
'does not work here
'Dim ipAddr As String = (IPAddress.Parse(CType(incomingClient.Client.RemoteEndPoint, IPEndPoint).Address.ToString())).ToString()
'MsgBox(ipaddr)
End Sub
I need to know how to access the ip address value here, and I need to capture the MAC address as well if I can.
Any help is greatly appreciated!
J