LinuxQuestions.org
Visit Jeremy's Blog.
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 02-02-2009, 03:34 PM   #1
Moraxus
LQ Newbie
 
Registered: Oct 2008
Posts: 26

Rep: Reputation: 15
Arrow [C++] Using socket created by another application


How can I send data through socket, which were created by another application?

I know it's possible because I did such a thing on windows, but I had a library which is unavailable for Linux.

I have basic knowledge about sockets programming.

Thanks in advance for any ideas!
 
Old 02-02-2009, 03:51 PM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
That all depends on 1) what type of socket, 2) if the process to use the socket is the child of the process creating it. I don't know about Windows, but I don't think you can just arbitrarily use a socket created by another process.
ta0kira
 
Old 02-02-2009, 04:14 PM   #3
Moraxus
LQ Newbie
 
Registered: Oct 2008
Posts: 26

Original Poster
Rep: Reputation: 15
Thanks for the reply.
Quote:
Originally Posted by ta0kira View Post
what type of socket
I'm not sure, it's created by online game client. I only know that it's tcp socket.
Quote:
Originally Posted by ta0kira View Post
if the process to use the socket is the child of the process creating it.
No, but if it's needed process creating socket can be child of process using it.
 
Old 02-02-2009, 04:49 PM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi, Moraxus -

I suspect the call you probably used in Win32 was "DuplicateHandle()".

You can share a socket descriptor between Linux processes by using "Unix domain sockets". Here are a couple of links that might help (you can find others with Google):

http://people.cis.ksu.edu/~singh/CIS...k_ipc_tut.html
http://cpansearch.perl.org/src/SAMPO...-0.03/passfd.c
http://lists.canonical.org/pipermail...ry/000292.html

An excellent reference is "Unix Network Programming", by W. Richard Stevens, ISBN 0131411551.

'Hope that helps .. PSM
 
  


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
Accessing application information from within a socket LMAC Linux - Networking 0 04-23-2006 02:16 AM
'Can a user be created with username as "/dev/null" in an application?' sheetal_govekar Linux - Software 1 08-25-2004 11:31 AM
Cannot compile a wx application created with KDevelop 3 wizard Mitsuhashi Linux - Newbie 6 06-10-2004 05:23 AM
Closing Socket in MultiThreaded Application Fails laalitseth Red Hat 0 04-21-2004 12:44 AM
Socket Application: Connection refused Agent007 Linux - Networking 1 01-27-2004 12:48 AM

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

All times are GMT -5. The time now is 08:41 PM.

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