Created
July 6, 2017 22:26
-
-
Save ephemient/7670f4a48e6cf3e866edb801ad960c5b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <netinet/ip.h> | |
#include <string.h> | |
int main(int argc, const char *const *argv) { | |
struct sockaddr_in6 a = | |
{ .sin6_family = AF_INET6, .sin6_addr = IN6ADDR_LOOPBACK_INIT }; | |
int s = socket(AF_INET6, SOCK_STREAM, 0); | |
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &(int) {1}, sizeof(int)); | |
bind(s, (struct sockaddr *) &a, sizeof(a)); | |
getsockname(s, (struct sockaddr *) &a, &(socklen_t) {sizeof(a)}); | |
connect(s, (struct sockaddr *) &a, sizeof(a)); | |
send(s, argv[argc > 1], strlen(argv[argc > 1]), 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment