Re: socket communication: socket doesn't connect



You can use select on the listening socket and wait for it to become
readable. This is your cue to call accept - you have at least one
client waiting so your accept will succeed. Note select is a blocking
operation - you may want to use it with a timeout in a loop so you
can abort from your server as needed. Finally, this only covers one
client. If your server is to handle multiple clients you'll need to be
handling multiple sockets in your select, or use a differnt thread
for your clients (for up to 63 clients), or multiple threads for handling
clients if they can exceed 63. select and WSASelect are rather similar
models, so you can use this one if you prefer. The main advantage
of WSASelect is you have uniform mechanism for controlling both
socket I/O and thread shutdown.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://vcfaq.mvps.org
=====================================

"Ananya" <Ananya@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BD2D1DBC-2B64-431D-ADC6-AC63EB66EF47@xxxxxxxxxxxxxxxx
Let me just add about the two communications between C++ and Java that I
need
as described above. The first one is done with ShellExecEx, so with
respect
to socket communications, I only need one communication, to bring the
curves
from my Java program back to my C++ program.


.



Relevant Pages

  • Re: NIO and accepts()
    ... > In a nutshell the idea is that an increasing number of clients will slow ... > anymore) whereas the iocp server still works. ... > synchronization with the socket subsystem) and perhaps send SYN/ACK ... Thread handling this will do it calls to the socket subsystem ... ...
    (comp.lang.java.programmer)
  • Re: C sockets
    ... :if no then select is only thing to have server socket program on one ... :pc and other clients on many pcs to have communication with server? ... serving N clients requires at least times the amount of memory ...
    (comp.lang.c)
  • Re: Asynchronous Sockets and the I/O Completion Port Model
    ... > I'm looking to build a TCP based service that will listen for connections ... > It will handle XML messages that are sent by connected clients, ... and point out that the .NET Socket class when used on NT-based ...
    (microsoft.public.dotnet.languages.csharp)
  • Problem with a Socket server Opening/Accepting Many sockets and the GC running.
    ... listening on port 11000 and ready to take a new connection. ... I created the Listener socket, ... THen all is well and my clients can connect for about another 3900 ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: NIO and accepts()
    ... The classic blocking socket scheme does not scale well and this is why ... I thought that NIO ... Even though the maximum number of clients is higher, ... On a 4 CPU machine, I'd typically want to have 8 threads processing IO ...
    (comp.lang.java.programmer)