Guest User

Untitled

a guest
Jul 10th, 2019
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include<netinet/ip.h>
  2. #include<sys/socket.h>
  3. #include<arpa/inet.h>
  4. #include <mpi.h>
  5.  
  6. int main() {
  7.     int packet_size;
  8.  
  9.     // Allocate string buffer to hold incoming packet data
  10.     // Open the raw socket
  11.     int sock = socket (PF_INET, SOCK_RAW, IPPROTO_TCP);
  12.     MPI_Init(nullptr, nullptr);
  13.     if(sock == -1)
  14.     {
  15.         //socket creation failed, may be because of non-root privileges
  16.         perror("Failed to create socket");
  17.         MPI_Finalize();
  18.         exit(1);
  19.     }
  20.  
  21.     MPI_Finalize();
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment