Thread: Is it possible to do this using C

  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    53

    Is it possible to do this using C

    Hello folks,

    This is a Yes or No question....

    If someone logs into your computer via a commercial software like LogMeIn or TeamViewer or the like, is it possible through C sockets code that we can find the IP of that computer no matter where it resides in the world?

    If so, can I do this using TCP or UDP protocols or both ?

    Thank you so much for your insight


    PS I don’t want any advice on tools to do this, I really want to be able to do this programmatically.... in C. Thanks

    STBC
    Last edited by see the big C; 07-22-2018 at 05:41 PM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Yes.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jun 2010
    Posts
    53
    Hey Salem, thank you so much for your reply!

    If you may allow me to take this a little further, the problem here is I don’t know which one would be better to use TCP or UDP?

    I say the “problem” because I think TCP you need a the client and server ends to have a C snippet in each to establish the communication.... where as UDP you don’t. Am I understanding this correctly?

    With UDP I can get the IP of the computer that is logged into my computer (remote) without having to run a UDP snippet on his computer right?

    Thanks for your help

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I can only suggest these.
    Windows netstat application - CodeProject
    GetTcpTable function | Microsoft Docs

    Your question has little to do with individual connections and whether or not they're TCP and/or UDP.

    It's about querying the overall state of the protocol stack.
    Essentially, "netstat" without the external tools.
    At least, that's how I read what you want.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Jun 2010
    Posts
    53
    Hi Salem,

    Ok so if I understand correctly, the first link is a Windows application which is an application that I have to run once a computer has entered mine.

    The second link is a C command that I can use in my C program to get the tcp info from the tcp table. I would need a link that talks about all the commands similar to the command in your second link. Is the command from your 2nd link part of C sockets programming and if so what is the best comprehensive tutorial on the subject?

    Thank you so much for your help!
    SBC

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > Is the command from your 2nd link part of C sockets programming and if so what is the best comprehensive tutorial on the subject?
    Well it's part of the Win32 network API.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Registered User
    Join Date
    Jun 2010
    Posts
    53
    Ok thank you Salem

Popular pages Recent additions subscribe to a feed

Tags for this Thread