Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- int main(int argc, char** argv) {
- int sockd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- struct sockaddr_in sockAddr;
- sockAddr.sin_family = AF_INET;
- sockAddr.sin_port = htons(8080);
- sockAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- connect(sockd, (struct sockaddr*)(&sockAddr), sizeof(sockAddr));
- char buf[] = "set foo 0 0 6\r\nfooval\r\n";
- send(sockd, buf, sizeof(buf), MSG_NOSIGNAL);
- recv(sockd, buf, sizeof(buf), MSG_NOSIGNAL);
- shutdown(sockd, SHUT_RDWR);
- printf("%s\n", buf);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement