Skip to content

Instantly share code, notes, and snippets.

@etosch
Created March 9, 2013 01:17
Show Gist options
  • Save etosch/5121963 to your computer and use it in GitHub Desktop.
Save etosch/5121963 to your computer and use it in GitHub Desktop.
Sample code for how to use simplesocket.cc
#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