Fixed bugs for debug session may 4 2012.
This commit is contained in:
parent
2d82dd6c2c
commit
c123111e70
3 changed files with 15 additions and 0 deletions
|
@ -102,6 +102,8 @@ bool DTSC::Stream::hasAudio(){
|
||||||
|
|
||||||
/// Returns a packed DTSC packet, ready to sent over the network.
|
/// Returns a packed DTSC packet, ready to sent over the network.
|
||||||
std::string & DTSC::Stream::outPacket(unsigned int num){
|
std::string & DTSC::Stream::outPacket(unsigned int num){
|
||||||
|
static std::string emptystring;
|
||||||
|
if (num >= buffers.size()) return emptystring;
|
||||||
buffers[num].Pack(true);
|
buffers[num].Pack(true);
|
||||||
return buffers[num].packed;
|
return buffers[num].packed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,18 @@ Socket::Connection::Connection(){
|
||||||
Blocking = false;
|
Blocking = false;
|
||||||
}//Socket::Connection basic constructor
|
}//Socket::Connection basic constructor
|
||||||
|
|
||||||
|
|
||||||
|
/// Set this socket to be blocking (true) or nonblocking (false).
|
||||||
|
void Socket::Connection::setBlocking(bool blocking){
|
||||||
|
int flags = fcntl(sock, F_GETFL, 0);
|
||||||
|
if (!blocking){
|
||||||
|
flags |= O_NONBLOCK;
|
||||||
|
}else{
|
||||||
|
flags &= !O_NONBLOCK;
|
||||||
|
}
|
||||||
|
fcntl(sock, F_SETFL, flags);
|
||||||
|
}
|
||||||
|
|
||||||
/// Close connection. The internal socket is closed and then set to -1.
|
/// Close connection. The internal socket is closed and then set to -1.
|
||||||
void Socket::Connection::close(){
|
void Socket::Connection::close(){
|
||||||
#if DEBUG >= 6
|
#if DEBUG >= 6
|
||||||
|
|
|
@ -33,6 +33,7 @@ namespace Socket{
|
||||||
Connection(int sockNo); ///< Create a new base socket.
|
Connection(int sockNo); ///< Create a new base socket.
|
||||||
Connection(std::string hostname, int port, bool nonblock); ///< Create a new TCP socket.
|
Connection(std::string hostname, int port, bool nonblock); ///< Create a new TCP socket.
|
||||||
Connection(std::string adres, bool nonblock = false); ///< Create a new Unix Socket.
|
Connection(std::string adres, bool nonblock = false); ///< Create a new Unix Socket.
|
||||||
|
void setBlocking(bool blocking); ///< Set this socket to be blocking (true) or nonblocking (false).
|
||||||
bool canRead(); ///< Calls poll() on the socket, checking if data is available.
|
bool canRead(); ///< Calls poll() on the socket, checking if data is available.
|
||||||
bool canWrite(); ///< Calls poll() on the socket, checking if data can be written.
|
bool canWrite(); ///< Calls poll() on the socket, checking if data can be written.
|
||||||
signed int ready(); ///< Returns the ready-state for this socket.
|
signed int ready(); ///< Returns the ready-state for this socket.
|
||||||
|
|
Loading…
Add table
Reference in a new issue