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

Author Topic: SocketXXX::Receive(Packet&) wait max  (Read 3052 times)

0 Members and 1 Guest are viewing this topic.

hajacken

  • Newbie
  • *
  • Posts: 11
    • View Profile
SocketXXX::Receive(Packet&) wait max
« on: February 21, 2009, 02:38:39 am »
Hi, is it possible to add a member function to SocketXXX to max wait Y seconds to receive data or something like it? Maybe have a second parameter? I wonder because if I connect from telnet (Microsoft) to my program now so will the SocketTCP::Receive(packet&) function only wait for input and never return how much the time than go. I can easy fix it by not use Packet but it looks so ugly by using SocketXXX::Receive(char *,...)  all the time:(

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
SocketXXX::Receive(Packet&) wait max
« Reply #1 on: February 21, 2009, 10:23:04 am »
There is a  "receive-with-timeout" function in the selector tutorial.
Maybe thats what you are looking for.
And its unlikely that you receive a packet unless you send one (sf::SocketTCP::Send(Packet& PacketToSend) sends the packet size before the data).

hajacken

  • Newbie
  • *
  • Posts: 11
    • View Profile
SocketXXX::Receive(Packet&) wait max
« Reply #2 on: February 21, 2009, 06:12:03 pm »
I will take a look at the selector::receive function:) Well, I know that it is unlikely it can receive a packet if I had never sent one, but my point is that if the function will only return when a packet had been sent and then should it be not so hard for anyone who have some programming knowledge to destroy any network based game which uses packets most of the time, but of course SFML should be easy and simple and if Laurent start to think of it all the time should SFML probably not be so good as it is today :)

Thanks