Skip to content

I cannot understand how to use the client. Created a main.cpp but it won't work #1

@NinaGitelman

Description

@NinaGitelman

This is what I used for a main on the peers:

  • Ive managed to connect to the server from the clients but not between

peer1:
#include "tcpunch.h"
#include

using std::cout;
using std::endl;

int main()
{
char buffer[1024];
int sock_fd = pair("my_pairing_name", "my-ip");
std::cout<<"here!";
int n = recv(sock_fd, buffer, 1024, 3126);
std::cout << "buffer: "<< buffer << endl;

}


// peer2:
#include "tcpunch.h"
#include

using std::cout;
using std::endl;

int main()
{
char buffer[1024];
sock_fd = pair("my_pairing_name", "myip");
char sendBuffer[] = "Hello world!";
int bytes = send(sock_fd, buffer, 14, 0);

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions