Tags down


How to get the port number from addrinfo in unix c

By : Kelly Whalen
Date : October 17 2020, 11:12 PM
hop of those help? I need to send some data to a remote server via UDP in a particular port and get receive a response from it. However, it is blocking and I do not get any response. I need to check if the addrinfo value that I get from the getaddrinfo(SERVER_NAME, port, &hints, &servinfo) is correct or not. , You do something similar to what Beej's get_in_addr function does:
code :

Share : facebook icon twitter icon

Get the port number from the process id in UNIX

By : Diego Alvis Palencia
Date : March 29 2020, 07:55 AM
I wish this helpful for you I am trying to get the port number for the running process in UNIX. , You can use lsof command to list ports in Mac OS X.
code :
# This will list all the ports
sudo lsof -i -P | grep -i LISTEN   

# This will list ports used by PID# <pid>
sudo lsof -i -P | grep -i LISTEN | grep <pid>

Getting UPTIME from port number in UNIX command

By : Qwin
Date : March 29 2020, 07:55 AM
it helps some times Is it possible to get the server UPTIME from mentioning PORT number or Process ID in UNIX command? Please help! ! , From port - I don't think so.
From process ID :
code :
ps -eo pid,etime | grep " 1 " | grep -v grep | awk '{print $2}'
root@localhost:~[0]$ ps -eo pid,etime | grep " 1 " | grep -v grep | awk '{print $2}'

In Java, is it possible to find out which port number is used by a known PID in UNIX systems?

By : adi_mahamuni
Date : March 29 2020, 07:55 AM
Hope this helps you can use Runtime.getRuntime().exec
For Example the fallowing code shows how to get tcp socket of process with PID
code :
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    Process p=null;
    StringBuffer output = new StringBuffer();
    String command= "netstat  -p ";
        p = Runtime.getRuntime().exec(command);
        BufferedReader reader =
                        new BufferedReader(new InputStreamReader(p.getInputStream()));

                    String line = "";
        while ((line = reader.readLine())!= null) {
            output.append(line + "\n");


    } catch (Exception e) {

tcp        0      0     sc-in-f188.1e100.n:5228 ESTABLISHED 2406/chrome

How to find port number for a particular process id in unix?

By : Mark Morris
Date : March 29 2020, 07:55 AM
To fix this issue

How to get xmlaccess port number on AIX/UNIX box?

By : sibskull
Date : March 29 2020, 07:55 AM
should help you out You can try the following and let me know how you get along,
$ grep -e "XmlAccessPort=" `find / -name wpconfig.properties 2>/dev/null`
Related Posts Related Posts :
  • Random int 1-255 to character in C
  • Problems with File I/o when porting old 'C' libraries from 32-bit to 64-bit
  • Static / global variables in shared library in C language
  • Is there a tool to list global variables used and output by a C function?
  • functions returning char pointer
  • How many elements are full in a C array
  • Resources for writing kernel in C
  • OpenGL: How do I avoid rounding errors when specifying UV co-ordinates
  • Basic skeleton for a C OpenGL program on OSX
  • Float versus integer data type calculation issues in C
  • What have you used sysv/posix message queues for?
  • Recursive harmonic function returns NaN
  • How to fix "unable to open stdio.h in Turbo C" error?
  • C programming structure passed as cast to char *?
  • Do I need to #include <omp.h> in my C/C++ sources?
  • Find original owning process of a Linux socket
  • How can I send e-mail in C?
  • How is the lagged fibonacci generator random?
  • Trouble with dangling pointers and character arrays in C
  • Trying to compile with cl.exe
  • C code compilation failure
  • Gtk Draw Bitmap
  • booting from a disk/cd/usb
  • Due to Shared memory, when MS Visual C 6.0 DLL crashes it also causes VB 6 EXE to crash
  • Error receiving in UDP: Connection refused
  • Should I declare the expected size of an array passed as function argument?
  • Is it possible to read in a string of unknown size in C, without having to put it in a pre-allocated fixed length buffer
  • How to use pcap_breakloop?
  • C Programming linux , read system inputs like ping or ls -l
  • Unsigned Short to Unsigned Long assignment
  • C: strtok on pointer inside a struct
  • How to put bits into a character Array
  • C moving the cursor to the beginning of the current line
  • libgtk version issue on ubuntu
  • creating a list of queues
  • Pointer to a specific fixed address
  • How to parse HTTP responses in C?
  • Use strtol or strtok to parse a string in C?
  • fread/fwrite string in C
  • c - random number generator
  • input-output in C
  • c - output to file
  • Reserve RAM in C
  • ncurses transparent console background
  • Faster math library than glibc on x86_64/linux?
  • For buffer overflows, what is the stack address when using pthreads?
  • I want to use Google Translate as part of some C code
  • Sort Hash Tables Glib - qsort
  • Is the next C standard actively developed?
  • Inserting into a Binary Tree which uses void* in C
  • c - fork() code
  • C .pc file warning
  • C warning Missing sentinel in function call
  • Getting printf() to drop the trailing ".0" of values
  • size of struct - size_t in c
  • Finding dimensions of a 2D array in C using pointers
  • C memset warning
  • Burning a CD programmatically
  • How to programatically convert a time from one timezone to another in C?
  • Need help implementing simple socket server using GIOService (GLib, Glib-GIO)
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org