Re: how to wait for socket communications

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,

For the C++ side you can wait based on a network event on your socket.
Use an overlapped structure and WaitForSingleObject (A UDP datagram from
your Java thing would be cool.)
Use a simple WSAEventSelect(socket, hEvent, FD_READ); & go into a 100 Ms
loop in a worker thread.
waiting for a UDP packet from your Java?
Sorry that's a bit cryptic. But may give you an idea - Search for socket
code based on network events.

CreateWindow


"Ananya" <Ananya@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1D672BFA-3444-48B5-8E48-0D60636F66FC@xxxxxxxxxxxxxxxx
I am trying to do socket communications between my C++ and my Java program.

I created a Java program for drawing curves and I connected it to Adobe's
C++ program for making a Photoshop plugin.

I am calling ShellExecuteEx for calling my Java program from C++, and it
brings up a separate window.

First I would like to communicate the Photoshop picture information into
my
Java window. Originally I tried to to that with the lpParameters string
in
ShellExecuteInfo, but it is too slow to build this string.

So now I am trying to communicate this with socket communication. I first
create a server in C++ before calling ShellExecuteEx, then I create a
client
in Java in the main method, but how can I wait in C++ for this Java client
to
be created before calling accept and sending the Photoshop picture
information?

I know I could just wait for a few seconds to make sure that my Java
program
came up by calling:
if ( ei.hProcess != NULL )
{
WaitForSingleObject(ei.hProcess, 10*1000 );
}
But I would rather not lose any time and just wait exactly until the Java
client is created.

And how can I wait in Java before receiving the picture information?

Finally, how can I wait in C++ for the Java program to close, at which
point
the information of curves that were drawn in Java is sent to C++ (to be
received for the workpath in Photoshop)?

Thanks for your time looking at this.


.



Relevant Pages

  • Java Network Programming FAQ
    ... Java Network Programming FAQ. ... How can I find out who is accessing my server? ... What are socket options, and why should I use them? ... How does servlet performance compare to applets? ...
    (comp.lang.java.programmer)
  • Java Network Programming FAQ
    ... Java Network Programming FAQ. ... How can I find out who is accessing my server? ... What are socket options, and why should I use them? ... How does servlet performance compare to applets? ...
    (comp.lang.java.programmer)
  • Java Network Programming FAQ
    ... Java Network Programming FAQ. ... How can I find out who is accessing my server? ... What are socket options, and why should I use them? ... How does servlet performance compare to applets? ...
    (comp.lang.java.programmer)
  • Java Network Programming FAQ
    ... Java Network Programming FAQ. ... How can I find out who is accessing my server? ... What are socket options, and why should I use them? ... How does servlet performance compare to applets? ...
    (comp.lang.java.programmer)
  • Java Network Programming FAQ
    ... Java Network Programming FAQ. ... How can I find out who is accessing my server? ... What are socket options, and why should I use them? ... How does servlet performance compare to applets? ...
    (comp.lang.java.programmer)