Results 1 to 11 of 11

Thread: Help finding IP address and username of users on a network

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    7

    Help finding IP address and username of users on a network

    I am making a network messenger and would like to add a function that checks the network for the usernames, IP addresses, and port numbers of users on the network. Is there visual basic code to do that? I need the actual code rather than just a link to a program or something. (sorry if that's assumed).

    Thanks in advance for your help!
    -Skoberlink

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Help finding IP address and username of users on a network

    This class here: http://www.pscode.com/vb/scripts/Sho...61827&lngWId=1

    Will list all computers on the network. From there you can ping for their IP, although you should just able to use the name to connect to them.

    And then you can use Winsock.RemoteHostIP once connected.

    I'm not sure about the username (assuming you mean their Windows username). There might be some APIs for that but I'm not sure.

    If not then you might just have to have the messenger send their Windows username (using the GetUsername() API function) once connected.

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    7

    Re: Help finding IP address and username of users on a network

    Yeah I meant their log on name (for example on my school network everyone has a login consisting of their initials and three numbers) I'd like to be able to find that to help identify users so that you know who you're messaging. I'll give this a try and see if it will work for what I'm trying. The uername bit was just something to make identifying users eaier but it wasn't really necessary. If there are any ideas on that they would be great, though!

  4. #4
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Help finding IP address and username of users on a network

    Quote Originally Posted by Skoberlink
    Yeah I meant their log on name (for example on my school network everyone has a login consisting of their initials and three numbers) I'd like to be able to find that to help identify users so that you know who you're messaging. I'll give this a try and see if it will work for what I'm trying. The uername bit was just something to make identifying users eaier but it wasn't really necessary. If there are any ideas on that they would be great, though!
    More info on how your messenger is gonna work would help.

    You are using Winsock right? Are you also building a server program that all clients will connect to? How are messages going to be transferred from one client to another?

    Either way it should be real simple, but it really depends on those questions above.

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    7

    Re: Help finding IP address and username of users on a network

    Well, I am using winsock but this is my very first program using winsock (except for very simple learning excercises) so I really don't know too much yet right now.

    For now the messenger is made to deal with just two people in one window. In other words, to talk to two people, you would actually have two windows open. (maybe in another version I'll make it so that multiple people can talk in one window but this is enough for the project)

    The server and client are both in this program. The messages are sent as string variables using the senddata winsock function.

    Thanks for bearing with me.

  6. #6
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Help finding IP address and username of users on a network

    Quote Originally Posted by Skoberlink
    Well, I am using winsock but this is my very first program using winsock (except for very simple learning excercises) so I really don't know too much yet right now.

    For now the messenger is made to deal with just two people in one window. In other words, to talk to two people, you would actually have two windows open. (maybe in another version I'll make it so that multiple people can talk in one window but this is enough for the project)

    The server and client are both in this program. The messages are sent as string variables using the senddata winsock function.

    Thanks for bearing with me.
    Don't worry, once you get the hang of the Winsock control and have written a few client/server programs you will see how it all works and it will be a peice of cake.

    For a 1-on-1 chat, building the server into the messenger might work (one person would act as a server, the other, the client).

    But when you bring multiple users into it, then it's best to just have one computer act as the server, and all clients connect to that server.

    The server will be responsible for receiving those messages, and relaying them to all other clients. That's basically how it would work in a situation where everyone is chatting to eachother (in a chat room).

    ie:

    Client1 sends message to server
    Server receives message
    Sends to Client1, 2, 3, etc...

    If it's 1-on-1 chat then you don't need to worry about this. But if more than 2 people connect then that's when it's best to use a server.

    If you need help feel free to attach your project and I'll help.

    Edit: Also, I wrote this very simple Winsock tutorial awhile ago. If you already know all the properties/methods of the Control then you probably don't need to read it, but it might still help:

    http://www.pscode.com/vb/scripts/Sho...44179&lngWId=1
    Last edited by DigiRev; Mar 27th, 2007 at 09:11 PM.

  7. #7

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    7

    Re: Help finding IP address and username of users on a network

    Yeah, I'll take a look at that too. Thanks a ton DigiRev. You helped a lot!

  8. #8
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: Help finding IP address and username of users on a network

    Quote Originally Posted by Skoberlink
    Yeah, I'll take a look at that too. Thanks a ton DigiRev. You helped a lot!
    No problem. I love programming Winsock stuff so I enjoy helping when I can.

    If you ever need help with something feel free to post here or PM me.

  9. #9
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Help finding IP address and username of users on a network

    I love your work DigiRev.

  10. #10
    Hyperactive Member
    Join Date
    Sep 2000
    Location
    NJ, USA
    Posts
    326

    Re: Help finding IP address and username of users on a network

    WMI will return to you who the currently logged in user is. Assuming, of course, you have admin rights on the machine and remote WMI is enabled.
    VB.NET 2005 Express with .Net 2.0
    C# 2010 .Net 4.0

  11. #11
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Help finding IP address and username of users on a network

    So will Environ$("username"), without needing WMI.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width