forked from codercheng/CodeSnippet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.cpp
More file actions
39 lines (29 loc) · 686 Bytes
/
Client.cpp
File metadata and controls
39 lines (29 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include "EasySock.h"
int main()
{
int sockFd;
CreateAndConn(sockFd, "127.0.0.1", 6868);
SockSend sockSend;
int iValue = 321;
char cValue = 'k';
long long int lValue = 9876543210;
bool bValue = true;
char cValue2 = 'T';
sockSend.Appendint32(iValue);
sockSend.AppendChar(cValue);
sockSend.AppendInt64(lValue);
sockSend.AppendBool(bValue);
sockSend.AppendChar(cValue2);
sockSend.SyncSend(sockFd);
close(sockFd);
printf("client exit successfully\n");
return 0;
}
// g++ -g -Wall EasySock.cpp Client.cpp -o Client