![]() |
![]() |
||||||
|
|||||||
| Tags: |
![]() |
|
|||
|
/** When testing network stuff here.. use UNIX telnet stuff.. some apps are
sending extra data... this is the reason you see me check for the # of data waiting to be read before i even start working... I also have functions which check for buffer over flow attacks and other types of hacks... ***/ -------------------------------------------------------------------------------- ---------------------------- you don't see this take place.. i did a cut and P. of some of my basic stuff to get ya going.. if you need any more help let me know.. I will be more than happy do do anything i can.. I am very sorry i didn't see this post until now.. |
| Sponsored Links |
|
|||
|
Sorry i just saw this or i would have posted sample code long ago..
Let me know if you need anything else.. when you accept a connection you call simple read/write functions to pass data... I am more than happy to help.. int main(int argc, char **argv) { FILE *fp; int listenfd, connfd, n, status ; const int on = 1; pid_t childpid; pid_t parent; socklen_t clilen; struct sockaddr_in cliaddr, servaddr; buff2=malloc(512); host_connect=malloc(14); listenfd = socket(AF_INET, SOCK_STREAM, 0); bzero(&servaddr, sizeof(servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_addr.s_addr = htonl(INADDR_ANY); servaddr.sin_port = htons(Put your port number here); setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); setsockopt(listenfd, SOL_SOCKET, TCP_NODELAY, &on, sizeof(on)); bind(listenfd, (struct sockaddr *) &servaddr, sizeof(servaddr)); listen(listenfd, 300); /** When testing network stuff here.. use UNIX telnet stuff.. some apps are sending extra data... this is the reason you see me check for the # of data waiting to be read before i even start working... I also have functions which check for buffer over flow attacks and other types of hacks... ***/ if ( ( parent = fork()) == 0 ) { for ( ; ; ) { clilen = sizeof(cliaddr); if ( (connfd = accept(listenfd, (struct sockaddr *) &cliaddr, &clilen)) < 0 ) { if ( errno == EINTR ) { continue; } else { perror("accept"); } } |
|
|||
|
/** When testing network stuff here.. use UNIX telnet stuff.. some apps are
sending extra data... this is the reason you see me check for the # of data waiting to be read before i even start working... I also have functions which check for buffer over flow attacks and other types of hacks... ***/ -------------------------------------------------------------------------------- ---------------------------- you don't see this take place.. i did a cut and P. of some of my basic stuff to get ya going.. if you need any more help let me know.. I will be more than happy do do anything i can.. I am very sorry i didn't see this post until now.. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise