LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 09-19-2008, 08:02 PM   #1
raghu2383
LQ Newbie
 
Registered: Jun 2008
Posts: 20

Rep: Reputation: 0
Prevent stealing of sockets


I am writing a tcp - ip application. Is there any way I can prevent a socket (or an active connection) from being stolen by another program?
For example : s = socket(AF_INET,SOCK_STREAM,0), here s is the descriptor for the socket. And if another program running on my machine steals the file descriptor, it can potentially start communicating with the server on the port that is bound to this socket later on.
I tried doing a google search and came across setsockopt() system call. In windows there seems to be an option called "SO_EXCLUSIVEADDRUSE". I could not find this option listed in <sys/socket.h>

Thanks in advance.
 
Old 09-19-2008, 09:51 PM   #2
Matir
Moderator
 
Registered: Nov 2004
Location: Kennesaw, GA
Distribution: Ubuntu
Posts: 8,502

Rep: Reputation: 110Reputation: 110
In what way do you anticipate another program "stealing" the file descriptor? Only your process or another process fork()ed from it could gain access to the FD. Once you have a socket bound to a port, no other application can use that port while your process is doing so.
 
Old 09-20-2008, 02:34 PM   #3
raghu2383
LQ Newbie
 
Registered: Jun 2008
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Matir View Post
In what way do you anticipate another program "stealing" the file descriptor? Only your process or another process fork()ed from it could gain access to the FD. Once you have a socket bound to a port, no other application can use that port while your process is doing so.
So you mean that a virus cannot read/ write stuff on the port that is being used by my application? Can you point me to any documentation that says that?

thanks in advance.
 
  


Reply

Tags
socket


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Program to forward tcp sockets to unix domain sockets mikepol Linux - Networking 0 09-28-2007 06:44 PM
be aware of ip stealing bujecas Linux - Networking 4 07-11-2007 12:48 PM
Stealing Bill's Glory...?! Hitboxx General 9 07-10-2007 11:14 PM
XMMS stealing soundcard TexasDex Linux - Software 5 03-10-2003 07:36 AM
demons stealing input lackluster Programming 0 05-26-2002 02:50 PM


All times are GMT -5. The time now is 01:11 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration