Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /****************************************************************************
- ringneckparrot (c)
- License: http://creativecommons.org/licenses/by-nc-sa/3.0/
- Contact Me:
- Email: ringneckparrot@hotmail.com
- Facebook: http://www.facebook.com/ringneckparrot
- Twitter ID: pp4rr0t
- SecurityTube: http://www.securitytube.net/user/ringneckparrot
- ****************************************************************************/
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <strings.h>
- #include <errno.h>
- #include <netinet/in.h>
- #define ErrorValue -1
- main()
- {
- int sock;
- int bindsock;
- int listensock;
- struct sockaddr_in info;
- sock = socket(AF_INET, SOCK_STREAM, 0);
- if ( sock == ErrorValue )
- {
- perror("Socket Error: ");
- exit(-1);
- }
- bzero(&info, sizeof(info));
- info.sin_family = AF_INET;
- info.sin_port = htons(1234);
- info.sin_addr.s_addr = INADDR_ANY;
- bindsock = bind(sock, (struct sockaddr *)&info, sizeof(info));
- if ( bindsock == ErrorValue )
- {
- perror("Bind Error: ");
- exit(-1);
- }
- listensock = listen(sock, 10);
- if ( listensock == ErrorValue )
- {
- perror("Listen Error: ");
- exit(-1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement