GameNetworkingSockets icon indicating copy to clipboard operation
GameNetworkingSockets copied to clipboard

Comments that mention ISteamNetworkingMessages::FlushMessagesToUser

Open tuket opened this issue 2 years ago • 3 comments

In the file "steamnetworkingtypes.h" there are many documentation comments that refer to a function called ISteamNetworkingMessages::FlushMessagesToUser. This function does not exist.

tuket avatar Jun 07 '23 11:06 tuket

Btw, from what I've read in the docs, you should be able to use the NoNagle flags for flushing. However, I have tried to send a message without nagle and, if I close the application immediately, the msg doesn't get to the destination.

My use case would be: when a player closes the game, I would like to send a DISCONNECT msg to the other end and shutdown my game immediately (without waiting for confirmation). How do you achieve that?

tuket avatar Jun 07 '23 11:06 tuket

A few things:

  • Good catch. I'll make a note to either write that function or update the docs.
  • If you care about cleaning up the "connection", you would probably be better off using a connection-oriented interface (one where you have an HSteamNetConnection). You should basically think of ISteamNetworkingMessages as a replacement for UDP sentro/recv from. For connection-oriented interfaces, there's usually no reason to send a "close message" - you just close the connection and the other side will get notified.
  • Remember that this is an application layer protocol running on top of UDP. It's not like a TCP connection where the operating system knows how to cleanup connections after you close them and terminate. So if you terminate the app, we're done and we cannot really do any more cleanup. You can fire off a message, but if that packet drops, the peer is not going to clean up the connection cleanly.
  • I think the k_nSteamNetworkingSend_NoNagle flag should work properly when sending messages using ISteamNetworkingMessages

zpostfacto avatar Jul 12 '23 00:07 zpostfacto

I think the k_nSteamNetworkingSend_NoNagle flag should work properly when sending messages using ISteamNetworkingMessages

I solved my problem a while ago, but I think this was the solution. Cheers.

tuket avatar Jul 23 '23 18:07 tuket