Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<netinet/ip.h>
- #include<sys/socket.h>
- #include<arpa/inet.h>
- #include <mpi.h>
- int main() {
- int packet_size;
- // Allocate string buffer to hold incoming packet data
- // Open the raw socket
- int sock = socket (PF_INET, SOCK_RAW, IPPROTO_TCP);
- MPI_Init(nullptr, nullptr);
- if(sock == -1)
- {
- //socket creation failed, may be because of non-root privileges
- perror("Failed to create socket");
- MPI_Finalize();
- exit(1);
- }
- MPI_Finalize();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment