checkpoint

This commit is contained in:
Michal Starski 2018-11-26 22:50:28 +01:00
parent 2f20425be7
commit ba56ecf910
5 changed files with 10 additions and 1 deletions

BIN
avClient

Binary file not shown.

BIN
avServer

Binary file not shown.

View File

@ -25,6 +25,13 @@ int main(int argc, char const *argv[])
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(PORT);
// Convert IPv4 and IPv6 addresses from text to binary form
if (inet_pton(AF_INET, "127.0.0.1", &serv_addr.sin_addr) <= 0)
{
printf("\nInvalid address/ Address not supported \n");
return -1;
}
if (connect(sock, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0)
{
printf("\nConnection Failed \n");

View File

@ -35,18 +35,20 @@ int main(int argc, char const *argv[])
perror("bind failed");
exit(EXIT_FAILURE);
}
printf("bind\n");
if (listen(server_fd, 3) < 0)
{
perror("listen");
exit(EXIT_FAILURE);
}
printf("listening\n");
if ((new_socket = accept(server_fd, (struct sockaddr *)&address,
(socklen_t *)&addrlen)) < 0)
{
perror("accept");
exit(EXIT_FAILURE);
}
printf("accepted\n");
int avatar_fd = open("assets/test.jpg", O_RDONLY);
if (avatar_fd < 0)
{

Binary file not shown.