Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5725 in orxonox.OLD for branches/network/src/lib


Ignore:
Timestamp:
Nov 23, 2005, 2:47:23 PM (19 years ago)
Author:
hdavid
Message:

added new function to NetworkSocket

Location:
branches/network/src/lib/network
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/network_socket.cc

    r5631 r5725  
    269269
    270270/**
     271 * Reads in the bytes form the network interface and passes it to the NetworkStream.
     272 * It only reads the bytes if there are enough bytes in our buffer.
     273 * @param data: pointer to memory, big enough to store length bytes
     274 * @param length: n bytes to read
     275 * @return the number successfully read bytes. -1 on error. 0 if there are not enough bytes in our buffer.
     276 */
     277int NetworkSocket::readBytesExact(byte * data, int length)
     278{
     279  if (incomingBufferLength >= length)
     280    return readBytes(data, length);
     281  else return 0;
     282}
     283
     284/**
    271285 * used to create a thread to listen
    272286 * will call thrad_read when established connection
  • branches/network/src/lib/network/network_socket.h

    r5722 r5725  
    8080  int writeBytes(byte * data, int length);
    8181  int readBytes(byte * data, int length);
     82  int readBytesExact(byte * data, int length);
    8283
    8384};
Note: See TracChangeset for help on using the changeset viewer.