31 lines
448 B
C++
31 lines
448 B
C++
|
#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);
|
||
|
}
|
||
|
}
|
||
|
|