Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: how safe is a tcp connection  (Read 4517 times)

0 Members and 1 Guest are viewing this topic.

csiz

  • Newbie
  • *
  • Posts: 30
    • Yahoo Instant Messenger - calinutzu92
    • View Profile
    • Email
how safe is a tcp connection
« on: June 05, 2009, 01:56:56 pm »
I have a few questions:
Is the tcp connection thread safe? I may do tcp.send(packet); from more than one thread but I still want the packets to be sent whole and in order

Are the data passing through it certain? If I send 1000000 times the number 0 will it be received every time 0?
My new webpage calinmocanu

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
how safe is a tcp connection
« Reply #1 on: June 05, 2009, 02:15:10 pm »
Quote
Is the tcp connection thread safe? I may do tcp.send(packet); from more than one thread but I still want the packets to be sent whole and in order

I don't know, I guess you have to read the documentation of the low-level sockets functions. But if you're talking about "order", I guess it means that your threads never try to send messages at the same time? So you shouldn't have any problem.

Quote
Are the data passing through it certain? If I send 1000000 times the number 0 will it be received every time 0?

Yes.
Laurent Gomila - SFML developer

csiz

  • Newbie
  • *
  • Posts: 30
    • Yahoo Instant Messenger - calinutzu92
    • View Profile
    • Email
how safe is a tcp connection
« Reply #2 on: June 05, 2009, 03:40:48 pm »
Hmm about the second one, I don't know if it was my fault but my program was blocking (seg fault) and when I checked the data I was receiving there was a 76 received that should have been 0 1 or 2.

I'll investigate that further...

ps read this http://en.wikipedia.org/wiki/Two_Generals%27_Problem
My new webpage calinmocanu