Solved

closing a socket using it's port name.

Posted on 2001-08-20
2
214 Views
Last Modified: 2006-11-17
Hi,

I want to close a an ephemeral port so i'll be able to bind it for recvfrom() (udp).
I noticed that shutdown() receives a sockfd but I only got the port's name.

Any ideas how do I do that?
0
Comment
Question by:naors
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
interiot earned 100 total points
ID: 6406127
From a sysadmin's standpoint, you could run something like "fuser":

    # fuser -n tcp 8000
    8000/tcp:            29178

    # ps -fp 29178    
    UID        PID  PPID  C STIME TTY          TIME CMD
    102      29178  8150  0 07:48 pts/5    00:00:00 ./junkbuster junkbstr.ini

From there, you could kill that process (or have fuser do it via -k) which would open up that tcp or udp socket.  
0
 

Author Comment

by:naors
ID: 6406406
I was trying to get an answer from a c programmer's standpoint, but nevertheless it's ok.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Where is my core dump file in Ubuntu? 12 461
How do I delete this file in Linux 2 458
Debian 3.16.7 3 153
unable to put logic for reading multiple repo in a single file 4 72
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question