Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


#ActualElCommunist

Posted 12 October 2013 - 09:37 AM

Hello everyone, and thanks for your valuable time smile.png

 

I am working on the networking part of a game, using SDL_Net as Networking library.

I tried the tutorial about SDL_Net TCP basics, and everything worked fine (server listening, client sending)

 

But now, I don't really know how to design the communication in both directions :

I would like to create one thread listening via the server TCP socket, and another thread sending via the same socket, at the same time (so this is the same TCP connection used for both sending and receiving, potentially simultaneously))

-> Is it safe ? performant ?

-> Or do I need to create one TCP connection for sending messages on one thread, and another TCP connection for listening on another thread ?

 

I know that some TCP connection are duplex which enable what I want, but I don't know about SDL Net...

 

Again, thanks for your help smile.png


#2ElCommunist

Posted 12 October 2013 - 05:44 AM

Hello everyone, and thanks for your valuable time smile.png

 

I am working on the networking part of a game, using SDL_Net as Networking library.

I tried the tutorial about SDL_Net TCP basics, and everything worked fine (server listening, client sending)

 

But now, I don't really know how to design the communication in both directions :

I would like to create one thread listening via the server TCP socket, and another thread sending via the same socket, at the same time (so this is the same TCP connection used for both sending and receiving, potentially simultaneously))

-> Is it safe ? performant ?

-> Or do I need to create one TCP connection for sending messages on one thread, and another TCP connection for listening on another thread ?

 

I know that some TCP connection are duplex which enable what I want, but I don't know about SDL Net...

 

Again, thanks for your help smile.png


#1ElCommunist

Posted 12 October 2013 - 05:44 AM

Hello everyone, and thanks for your valuable time smile.png

 

I am working on the networking part of a game, using SDL_Net as Networking library.

I tried the tutorial about SDL_Net TCP basics, and everything worked fine (server listening, client sending)

 

But now, I don't really know how to design the communication in both directions :

I would like to create one thread listening via the server TCP socket, and another one sending via the same socket, at the same time (so this is the same TCP connection used for both sending and receiving, potentially simultaneously))

-> Is it safe ? performant ?

-> Or do I need to create one TCP connection for sending messages on one thread, and another TCP connection for listening on another thread ?

 

I know that some TCP connection are duplex which enable what I want, but I don't know about SDL Net...

 

Again, thanks for your help smile.png


PARTNERS