Changes
This commit is contained in:
commit
a19e8a12a5
BIN
2_example.pcapng
Executable file
BIN
2_example.pcapng
Executable file
Binary file not shown.
20
2_program.c
Executable file
20
2_program.c
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#include <sys/socket.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
struct sockaddr_in adr;
|
||||||
|
int s;
|
||||||
|
|
||||||
|
s = socket(PF_INET, SOCK_STREAM, 0);
|
||||||
|
adr.sin_family = AF_INET;
|
||||||
|
adr.sin_port = htons(40);
|
||||||
|
adr.sin_addr.s_addr = inet_addr("150.254.78.2");
|
||||||
|
|
||||||
|
connect(s, (struct sockaddr*) &adr, sizeof(adr));
|
||||||
|
printf("Done.");
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
6_example.pcapng
Executable file
BIN
6_example.pcapng
Executable file
Binary file not shown.
31
6_program.c
Executable file
31
6_program.c
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
struct sockaddr_in adr;
|
||||||
|
int s, bytesSend;
|
||||||
|
char message = 0x0a;
|
||||||
|
|
||||||
|
s = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
adr.sin_family = AF_INET;
|
||||||
|
adr.sin_port = htons(40);
|
||||||
|
adr.sin_addr.s_addr = inet_addr("150.254.76.1");
|
||||||
|
|
||||||
|
bytesSend = (int) sendto(s,&message, 1, 0, (struct sockaddr*) &adr, sizeof(adr));
|
||||||
|
if (bytesSend != 1) {
|
||||||
|
printf("SOME ERROR.");
|
||||||
|
} else {
|
||||||
|
printf("UDP PACKET WAS SEND.");
|
||||||
|
}
|
||||||
|
close(s);
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
SieciProjekt2.odt
Executable file
BIN
SieciProjekt2.odt
Executable file
Binary file not shown.
BIN
SieciProjekt2.pdf
Executable file
BIN
SieciProjekt2.pdf
Executable file
Binary file not shown.
BIN
dns_query.pcapng
Normal file
BIN
dns_query.pcapng
Normal file
Binary file not shown.
BIN
tracepath_wmi-amu-edu-pl.pcapng
Normal file
BIN
tracepath_wmi-amu-edu-pl.pcapng
Normal file
Binary file not shown.
BIN
traceroute_wmi-amu-edu-pl.pcapng
Normal file
BIN
traceroute_wmi-amu-edu-pl.pcapng
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user