Created
March 9, 2013 01:17
-
-
Save etosch/5121963 to your computer and use it in GitHub Desktop.
Sample code for how to use simplesocket.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "simplesocket.h" | |
#include <sstream> | |
int main(int argc, char * argv[]){ | |
// continually transmit something here | |
int port; | |
stringstream(argv[1]) >> port; | |
serversocket * s = new serversocket(port, -1, true); | |
char buffer[256]; | |
while (!strcmp(buffer,"")) { | |
simplesocket * c = s->accept(); | |
printf("1:%d\n", c->read(buffer, 256)); | |
printf("2:%s\n", buffer); | |
} | |
s->close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment