Jump to content

  • Log In with Google      Sign In   
  • Create Account


Winsock Multiprocess Issues


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Hedanito   Members   -  Reputation: 134

Like
0Likes
Like

Posted 04 April 2012 - 03:44 AM

So I have this really weird bug with I have been trying to fix for the past 3 days.

I basically have 2 applications, one is the game, the other one is an editor.
I connect them together so I can send data around.
The game has a listening socket and the editors just try to connect to it every once in a few seconds.

This works fine, but there is this really weird and specific bug.
I have the option to launch an instance of the editor from the game.
When I do this (using anything from sytem to CreateProcess, I tried them all), the editor launches and connects as expected.
When I then shut down the game the editor loses connection.

But here is where it gets weird.
For some reason the next time it tries to connect, it succeeds.
Even though the game is not running.
Then it disconnects because it doesn't receive any ping message (because there is no game to send them) and thinks that it has timed out.
After that, it reconnects again.
And it just keeps doing this over and over.
And this just happens when I start the process from the game.
When I launch the editor seperately, this does not happen, and everything works perfectly.

So I hope that any of you have any idea what is going on here, because I really don't know anymore.

Sponsor:

#2 Hedanito   Members   -  Reputation: 134

Like
0Likes
Like

Posted 04 April 2012 - 09:28 AM

After some more debugging I think I have found at least where it goes wrong (but still no idea why).
For some reason the sockets keeps hanging around when a process is launched from the game.
I tried starting notepad from the game, and then shutting the game down, and everything will think that the socket still exists.
The moment I shut down notepad however everything goes back to normal.
Now I played around a LOT with shutting down the socket.
I tried pretty much every way and step in between to shut it down, but none of them seem to fix the problem.
Even resetting everything everywhere, including calling WSAStartup and WSAShutdown does not seem to help.

#3 hplus0603   Moderators   -  Reputation: 4970

Like
1Likes
Like

Posted 04 April 2012 - 10:23 AM

The open socket handle is probably being inherited by the child process. You should look up on MSDN how to mark the handle as no-inherit before calling CreateProcess().
enum Bool { True, False, FileNotFound };

#4 Hedanito   Members   -  Reputation: 134

Like
0Likes
Like

Posted 05 April 2012 - 01:39 AM

Yes that seemed to be the problem.
Changing some settings in CreateProcess fixed the problem.
Thank you for your help.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS