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

Author Topic: sf::Socket::Done  (Read 2339 times)

0 Members and 1 Guest are viewing this topic.

troopson

  • Newbie
  • *
  • Posts: 30
    • View Profile
sf::Socket::Done
« on: July 10, 2011, 03:04:58 pm »
i have client-server application
Client-streaming voice and sending movement messages
Server-gets messages from every client and replies to everyone
Blocking is set to false.
My app works perfectly but suddenly when i send a packet with my movement.

Code: [Select]
if (Send(pac) != sf::Socket::Done){
cout<<err<<endl;
}


It printfs "err" and my voice is no longer streamed.

my mainloop looks like this:
Code: [Select]

while(1){
/*...*/
getpac();
sendpac();
/*...*/
}

troopson

  • Newbie
  • *
  • Posts: 30
    • View Profile
sf::Socket::Done
« Reply #1 on: July 10, 2011, 11:23:46 pm »
Okay ... the problem was on OnProcess samples - function returned false stopping streaming

the solution:
Code: [Select]

bool  NetworkRecorder::OnProcessSamples(const sf::Int16* Samples, std::size_t SamplesCount){
        sf::Packet PacketOut;
        PacketOut << AUDIODATA;
        PacketOut.Append(Samples, SamplesCount * sizeof(sf::Int16));
sf::Socket::Status st=Application::instance->internet.Send(PacketOut);

while(st==sf::Socket::NotReady){
st=Application::instance->internet.Send(PacketOut);
Sleep(0.001f);
}
return st==sf::Socket::Done;
    }

not sure if i lose some voice i say coz of blocking the function, im not sure if another thread executes this function on another stack

 

anything