Solved

closing a socket using it's port name.

Posted on 2001-08-20
2
199 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
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Linux script help 27 237
Linux , how can I inspect a tar GZ file 3 130
Linux 10 106
centOS 7 GUI is now showing. 20 962
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now