LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-17-2003, 09:47 PM   #1
Ivan Lee
LQ Newbie
 
Registered: Feb 2003
Posts: 7

Rep: Reputation: 0
about socket port


Hi all!

How can i ensure a socket port is unused (bind)?
thx!
 
Old 03-18-2003, 07:12 AM   #2
no2nt
Member
 
Registered: Aug 2001
Location: South Carolina, USA
Distribution: Redhat 8.0/Custom
Posts: 96

Rep: Reputation: 16
I don't recall that you can ensure that a socket is bound but you can reuse a socket with setsockopt() and SO_REUSEADDR option.
 
Old 03-19-2003, 12:55 AM   #3
Ivan Lee
LQ Newbie
 
Registered: Feb 2003
Posts: 7

Original Poster
Rep: Reputation: 0
Thank you firstly!

But i know that when a client socket connected to the server, system will automatically assigns a port to it. My troubling is that how can system determine an unused port?
 
Old 03-19-2003, 02:10 AM   #4
GtkUser
Member
 
Registered: Sep 2002
Location: Canada
Distribution: Redhat 9.0
Posts: 637

Rep: Reputation: 30
Linux Socket Programming ISBN: 0672319357
 
Old 03-20-2003, 03:45 AM   #5
Ivan Lee
LQ Newbie
 
Registered: Feb 2003
Posts: 7

Original Poster
Rep: Reputation: 0
thanks all!

i got it: rresvport()
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what is the difference between socket & port? fssengg Linux - Newbie 4 05-16-2005 12:05 AM
How to connect server with muliple port via socket husniteja Programming 0 08-21-2004 02:25 AM
Close socket/port THETEZ Linux - General 4 03-28-2004 08:05 PM
Why is my socket unable to bind to the port in the C Code. mcp_achindra Programming 10 03-24-2004 08:34 AM
Socket binding to port problems Xris718 Linux - General 0 07-10-2003 01:04 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration