Я пытаюсь подключиться к клиенту к серверу, но он показывает сброс соединения по пиру
printf("Client Sends **** |Version = %2u | Packet Type = %2u | Packet Length = %d | ClientID = %d | **** \n", SendHeader.ProtocolVersion, SendHeader.PacketType,SendHeader.PacketLength, SendHeader.ClientId);
int ResultReceived = 0;
while (1) {
if ((recv(sockfd, &RecvHeader, sizeof(RecvHeader), 0)) <= 0) {
perror("recv invalid Bet");
close(sockfd);
exit(1);
}
printf("\n\nClient Receiv`enter code `es **** |Version = %2u | Packet Type = %2u | Packet Length = %d | ClientID = %d | **** `enter code here`\n",RecvHeader.ProtocolVersion`RecvHeader.PacketType,RecvHeader.PacketLength, RecvHeader.ClientId);
switch (RecvHeader.PacketType) {
case BEGASEP_ACCEPT:
printf("\n");
Begasep_AcceptMsg AcceptMessage;
if ((recv(sockfd, &AcceptMessage, sizeof(AcceptMessage), 0)) <= 0) {
perror("recv");
exit(1);
Выход:
client: connecting to 127.0.0.1
Client Sends **** |Version = 1 | Packet Type = 1 | Packet Length = 4 | ClientID = 0 |
**** recv invalid Bet: Connection reset by peer