#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
int main(int argc, char *argv[])
{
int listenfd = 0, connfd = 0;
int yes =1;
struct sockaddr_in serv_addr;
char sendBuff[1025];
if (listenfd = socket(PF_INET, SOCK_STREAM, 0)==-1){
}
if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int))==-1){
}
memset(&serv_addr
, '0', sizeof(serv_addr
)); memset(sendBuff
, '0', sizeof(sendBuff
));
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_port = htons(52142);
if (bind(listenfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr))==-1){
}
listen(listenfd, 10);
while(1)
{
connfd = accept(listenfd, (struct sockaddr*)NULL, NULL);
send(connfd,"Hallo",5,0);
close (connfd);
}
close (listenfd);
}
I2luY2x1ZGUgPHN5cy9zb2NrZXQuaD4KI2luY2x1ZGUgPG5ldGluZXQvaW4uaD4KI2luY2x1ZGUgPGFycGEvaW5ldC5oPgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0ZGxpYi5oPgojaW5jbHVkZSA8dW5pc3RkLmg+CiNpbmNsdWRlIDxlcnJuby5oPgojaW5jbHVkZSA8c3RyaW5nLmg+CiNpbmNsdWRlIDxzeXMvdHlwZXMuaD4KI2luY2x1ZGUgPHRpbWUuaD4gCgppbnQgbWFpbihpbnQgYXJnYywgY2hhciAqYXJndltdKQp7CiAgICBpbnQgbGlzdGVuZmQgPSAwLCBjb25uZmQgPSAwOwoJaW50IHllcyA9MTsKICAgIHN0cnVjdCBzb2NrYWRkcl9pbiBzZXJ2X2FkZHI7IAoKICAgIGNoYXIgc2VuZEJ1ZmZbMTAyNV07CgogICAgaWYgKGxpc3RlbmZkID0gc29ja2V0KFBGX0lORVQsIFNPQ0tfU1RSRUFNL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