-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.cpp
More file actions
31 lines (28 loc) · 788 Bytes
/
client.cpp
File metadata and controls
31 lines (28 loc) · 788 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
#include "sock_wrap.h"
using namespace ModelSQL;
int main()
{
try
{
ClientSocket sock(default_address);
std::cout << "(Client) Read from server: " << sock.GetString();
std::string str;
// sending a message to server
getline(std::cin, str, '\n');
sock.PutString(str);
// new message from the server
std::cout << "(Client) Read from server: " << sock.GetString() << std::endl;
while (str != "END")
{
getline(std::cin, str, '\n');
sock.PutString(str);
std::cout << "(Client) Read from server: " << sock.GetString() << std::endl;
}
}
catch (SocketException &e)
{
// error --- output the message
e.report();
}
return 0;
}