troubleshooting Question

VB.NET Pogramming question(how to get the ip)

Avatar of aumudin
aumudinFlag for United States of America asked on
Programming Languages-Other.NET ProgrammingVisual Basic.NET
8 Comments1 Solution392 ViewsLast Modified:
Just wondering if there is a easier way to get the ip through vb.net code then having the client when he logs in send a text message of what his ip he is using. Here is my code

While (bExit = False)

                'accept an incoming connection
                connection = listener.AcceptTcpClient

                'Get Data
                socketStream = connection.GetStream

                'declare a byte array to store data
                Dim bytes(connection.ReceiveBufferSize) As Byte

                'Transfer Data from Stream to byte array
                socketStream.Read(bytes, 0, CInt(connection.ReceiveBufferSize))

                'Conver the Byte into String
                reader = Encoding.ASCII.GetString(bytes)

                'Indicate that Data was received successfully on the Form
                Me.txtData.Text &= vbCrLf & "Connection  received."

                ' Step 4: Display the message on the form
                Me.txtData.Text &= vbCrLf & "Message: " & reader

                'Show as a marker of end of message
                Me.txtData.Text &= vbCrLf & "User terminated connection" & vbCrLf

                'Close connection
                socketStream.Close()
                connection.Close()

            End While


What i'm wanting to do is every time a person connects it stores there ip in a array or in later projects a database. If I store it in the array I can store what clients are connected then when client 1 sends a message, the server sends it out to all the rest of the clients pretty much like a messaging program. Late r projects I also want to store there user name to see who does what but you get my idea I think. If you have any questions let me know.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros