Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| bb7c899424 |
2 changed files with 3 additions and 34 deletions
|
|
@ -1,2 +1,5 @@
|
||||||
# Y
|
# Y
|
||||||
|
|
||||||
|
this is my x but its better so i named it y because it stands for yes nad its an alphabet number before x because its faster
|
||||||
|
|
||||||
|
elon musk csan EAT MY SHORTS"!!!!!!!!!!! XD :9\)
|
||||||
34
main.c
34
main.c
|
|
@ -1,34 +0,0 @@
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include<unistd.h>
|
|
||||||
|
|
||||||
#define error(a) do {} while(0)
|
|
||||||
|
|
||||||
// this is main function
|
|
||||||
int main(
|
|
||||||
// arguments:
|
|
||||||
){
|
|
||||||
int my_soket = socket(AF_INET, SOCK_STREAM, 0)
|
|
||||||
;
|
|
||||||
// https://stackoverflow.com/questions/24194961/how-do-i-use-setsockoptso-reuseaddr
|
|
||||||
// Source - https://stackoverflow.com/a
|
|
||||||
// Posted by Chnossos, modified by community. See post 'Timeline' for change history
|
|
||||||
// Retrieved 2025-12-10, License - CC BY-SA 4.0
|
|
||||||
|
|
||||||
if (setsockopt(my_soket, SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int)) < 0)
|
|
||||||
error("setsockopt(SO_REUSEADDR) failed");
|
|
||||||
|
|
||||||
struct sockaddr_in serv_addr, cli_addr;
|
|
||||||
|
|
||||||
bzero((char *) &serv_addr, sizeof(serv_addr));
|
|
||||||
portno = atoi(argv[1]);
|
|
||||||
serv_addr.sin_family = AF_INET;
|
|
||||||
serv_addr.sin_addr.s_addr = INADDR_ANY;
|
|
||||||
serv_addr.sin_port = htons(portno);
|
|
||||||
if (bind(my_soket, (struct sockaddr *) &serv_addr,
|
|
||||||
sizeof(serv_addr)) < 0)
|
|
||||||
error("ERROR on binding");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue