fetching port number

This is a discussion on fetching port number within the C++ Programming forums, part of the General Programming Boards category; I have a process (server.exe) which is accessing port number 1101. i am making another program which should to know ...

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    4

    Arrow fetching port number

    I have a process (server.exe) which is accessing port number 1101. i am making another program which should to know what port is using process server.exe.

    How will i do it ?

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    If the only means of communicating with server.exe is thru the port, then you need to know the port just to communicate, right? So simply hardcode the other program with that port number.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875
    Quote Originally Posted by ajay009ajay View Post
    I have a process (server.exe) which is accessing port number 1101. i am making another program which should to know what port is using process server.exe.

    How will i do it ?
    There is a way to do it on unix/Linux but I don't know about Windows...a combination of lsof and grep will do it on Linux...
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 11
    Last Post: 10-07-2008, 07:19 PM
  2. Number Guessing
    By blacknapalm in forum C Programming
    Replies: 2
    Last Post: 10-01-2008, 02:48 AM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 06:49 PM
  4. Problems with connect and select...
    By scrappy in forum Networking/Device Communication
    Replies: 4
    Last Post: 12-24-2003, 08:19 PM
  5. Random Number problem in number guessing game...
    By -leech- in forum Windows Programming
    Replies: 8
    Last Post: 01-15-2002, 05:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21