Thread View: borland.public.cppbuilder.nativeapi
6 messages
6 total messages
Started by Regis St-Gelais
Wed, 26 Sep 2007 20:18
Share a WinSock socket between EXEs ??
Author: Regis St-Gelais
Date: Wed, 26 Sep 2007 20:18
Date: Wed, 26 Sep 2007 20:18
13 lines
1249 bytes
1249 bytes
I have an application that create a listening socket using winsock.dll After connection (using accept), I would like to start another exe and pass it the connected socket. Is this possible ?? Both applications are in OwlNext using BC++5.02 IDE / BCC 5.5 Compiler TIA -- Regis St-Gelais www.laubrass.com
Re: Share a WinSock socket between EXEs ??
Author: Remy Lebeau (TeamB)
Date: Wed, 26 Sep 2007 20:25
Date: Wed, 26 Sep 2007 20:25
17 lines
1275 bytes
1275 bytes
"Regis St-Gelais" <regis.st-gelais@NOSPAMlaubrass.com> wrote in message
news:46fabea9$1@newsgroups.borland.com...
> After connection (using accept), I would like to start another
> exe and pass it the connected socket.
Why not use a thread instead of an exe for that?
> Is this possible ??
Technically yes. You need to use WSADuplicateSocket() for that:
http://msdn2.microsoft.com/en-us/library/ms741565.aspx
Gambit
Re: Share a WinSock socket between EXEs ??
Author: Regis St-Gelais
Date: Thu, 27 Sep 2007 12:20
Date: Thu, 27 Sep 2007 12:20
27 lines
1776 bytes
1776 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> a �crit dans le message de news: 46fac06c@newsgroups.borland.com... > > Why not use a thread instead of an exe for that? > It's just paching an existing application and its not design to handle threads in that way. >> Is this possible ?? > > Technically yes. You need to use WSADuplicateSocket() for that: > > http://msdn2.microsoft.com/en-us/library/ms741565.aspx > Thanks for the information. I plan to use a Named Shared Memory to pass WSAPROTOCOL_INFO to the client. great, I will play with that. Regards, -- Regis St-Gelais www.laubrass.com
Re: Share a WinSock socket between EXEs ??
Author: Regis St-Gelais
Date: Thu, 27 Sep 2007 12:31
Date: Thu, 27 Sep 2007 12:31
15 lines
1577 bytes
1577 bytes
Another quick question. When I call WSADuplicateSocket, I need to pass it the process identifier of the target process in which the duplicated socket will be used. How can I start an exe and find it's process id. EnumProcess might not be what I need because I can have many instances of that same exe running and it would be hard to tell wich is the right one. Any suggestion?? TIA -- Regis St-Gelais www.laubrass.com
Re: Share a WinSock socket between EXEs ??
Author: Regis St-Gelais
Date: Thu, 27 Sep 2007 13:00
Date: Thu, 27 Sep 2007 13:00
12 lines
1549 bytes
1549 bytes
"Regis St-Gelais" <regis.st-gelais@NOSPAMlaubrass.com> a �crit dans le message de news: 46fba293$1@newsgroups.borland.com... > How can I start an exe and find it's process id. Looks like I will need to start the exe using CreatProcess -- Regis St-Gelais www.laubrass.com
Re: Share a WinSock socket between EXEs ??
Author: Remy Lebeau (TeamB)
Date: Thu, 27 Sep 2007 17:01
Date: Thu, 27 Sep 2007 17:01
18 lines
1548 bytes
1548 bytes
"Regis St-Gelais" <regis.st-gelais@NOSPAMlaubrass.com> wrote in message news:46fba293$1@newsgroups.borland.com... > When I call WSADuplicateSocket, I need to pass it > the process identifier of the target process in which > the duplicated socket will be used. Which you will know since you are starting the new process yourself after accepting the socket. > How can I start an exe and find it's process id. If you are using CreateProcess() to start the .exe, then it returns that information to you. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads