Last active
August 29, 2015 14:11
-
-
Save OmarMalik/8b847439b0cb371736df to your computer and use it in GitHub Desktop.
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
int main(int argc, char **argv) | |
{ | |
int listenfd, port; | |
char * root = NULL; | |
int opt; | |
while ((opt = getopt(argc, argv, "p:R:")) > 0) | |
{ | |
switch(opt) | |
{ | |
case 'p': | |
port = atoi(optarg); | |
case 'R': | |
root = optarg; | |
break; | |
} | |
} | |
list_init(&memory_list); | |
listenfd = Open_listenfd(port); | |
pthread_t ipv6_thread, ipv4_thread; | |
pthread_create(&ipv4_thread, NULL, &doit, NULL); | |
pthread_create(&ipv6_thread, NULL, &doit, NULL); | |
} | |
void * ipv6_listener() | |
{ | |
int clientlen, connfd; | |
struct sockaddr_in clientaddr; | |
while(1) { | |
pthread_t thread; | |
clientlen = sizeof(clientaddr); | |
connfd = Accept(listenfd, (SA *)&clientaddr, &clientlen); | |
pthread_create(&thread, NULL, &doit, (void *)connfd); | |
} | |
} | |
void * ipv4_listener() | |
{ | |
int clientlen; | |
struct sockaddr_in clientaddr; | |
while(1) { | |
pthread_t thread; | |
clientlen = sizeof(clientaddr); | |
connfd = Accept(listenfd, (SA *)&clientaddr, &clientlen); | |
pthread_create(&thread, NULL, &doit, (void *)connfd); | |
} | |
} | |
/* | |
ssh -L 17857:localhost:17857 yourpid@rlogin.cs.vt.edu | |
http://localhost:17857/ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment