Add 'JsonTestSender.cpp'

This commit is contained in:
Kirigaya Kazuto 2017-03-09 12:22:12 +08:00
parent fbf38130d7
commit b6e07fabdd

30
JsonTestSender.cpp Normal file
View File

@ -0,0 +1,30 @@
#include <cpplib/cpplib#gsock>
using namespace std;
char buff[1024];
void rcc(sock& s)
{
char tbuff[1024];
while(1)
{
memset(tbuff,0,1024);
s.recv(tbuff,1024);
printf("%s\n",tbuff);
}
}
int main()
{
sock s;
s.connect("123.206.86.73",55555);
thread td(rcc,ref(s));
td.detach();
while(1)
{
gets(buff);
strcat(buff,"\n");
s.send(buff,strlen(buff)+1);
}
}