Skip to content

Instantly share code, notes, and snippets.

View listnukira's full-sized avatar

listnukira listnukira

  • NCTU
  • Hsinchu, Taiwan
View GitHub Profile
@listnukira
listnukira / simple_bot_rev2.c
Created November 27, 2012 12:35
simple bot rev2
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define SERVER_ADDR "140.113.216.151"
#define SERVER_PORT 12346
#define PRIME 43
@listnukira
listnukira / get_ip_v2.c
Created November 9, 2012 13:18
use gethostbyname to get ip
#include <stdio.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
int main() {
char hostname[128];
char ip[16];
struct hostent* host;
struct sockaddr_in sock_addr;
@listnukira
listnukira / get_ip_v1.c
Last active March 18, 2023 16:58
use getsockname to get ip and port
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define SERVER_ADDR "172.217.160.99"
#define SERVER_PORT 80
@listnukira
listnukira / gist:4043595
Created November 9, 2012 03:55
simple bot
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define SERVER_ADDR "140.113.216.151"
#define SERVER_PORT 12345
int main()