|
|
@ -226,8 +226,8 @@ class NetworkConnection { // Essentially a Socket wrapper
|
|
|
|
NetworkConnection(uint16_t port); // TODO: Add UDP, TCP choice?
|
|
|
|
NetworkConnection(uint16_t port); // TODO: Add UDP, TCP choice?
|
|
|
|
|
|
|
|
|
|
|
|
void listen(); // TODO: Return a useful value?
|
|
|
|
void listen(); // TODO: Return a useful value?
|
|
|
|
|
|
|
|
|
|
|
|
int isConnected();
|
|
|
|
int isConnected();
|
|
|
|
|
|
|
|
byte read();
|
|
|
|
void NetworkConnection::close();
|
|
|
|
void NetworkConnection::close();
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
private:
|
|
|
@ -250,6 +250,17 @@ void NetworkConnection::listen() { // TODO: Make private or protected?
|
|
|
|
::listen(_socket); // TODO: Use C++ namespaces for the driver functions?
|
|
|
|
::listen(_socket); // TODO: Use C++ namespaces for the driver functions?
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte NetworkConnection::read() {
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note: This blocks until a byte is available.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
uint8_t theByte;
|
|
|
|
|
|
|
|
recv(_socket, &theByte, 1);
|
|
|
|
|
|
|
|
return theByte;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int NetworkConnection::isConnected() {
|
|
|
|
int NetworkConnection::isConnected() {
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|