|
|
Home » U++ Library support » U++ MT-multithreading and servers » Problem using TcpSockets
Problem using TcpSockets [message #41919] |
Wed, 05 February 2014 21:02 |
|
koldo
Messages: 3394 Registered: August 2008
|
Senior Veteran |
|
|
Hello!
I have been playing successfully with sockets based in SocketServer ans SocketClient demos.
However I have had problems with a simple program that sends plain text messages ended with a '\n with:
char *buf = "Message\n";
send(socket, buf, strlen(buf), 0);
Looking to SocketServer demo, it seems that s.Accept(server) blocks the program the second time. I mean:
- 1st s.Accept(server) passes just when demo program begins to send messages
- s.GetLine() works properly
- 2st s.Accept(server) blocks the program
However, if s.GetLine() is called in a loop, it takes all the messages properly.
Is there any kind of protocol embedded in TcpSocket used the way is used in SocketServer/Client demos, that does not match with plain send() calls?
Best regards
Iñaki
|
|
|
|
|
|
|
Re: Problem using TcpSockets [message #42028 is a reply to message #42018] |
Wed, 12 February 2014 10:13 |
|
koldo
Messages: 3394 Registered: August 2008
|
Senior Veteran |
|
|
I understand. This happened to me with an external program I wanted to connect to.
In addition, I have to do a socket client in plain C that I wanted to connect to an U++ server. Would I have to close the connection every time I send a data stream?
Best regards
Iñaki
[Updated on: Wed, 12 February 2014 10:13] Report message to a moderator
|
|
|
|
Re: Problem using TcpSockets [message #42059 is a reply to message #41919] |
Fri, 14 February 2014 11:41 |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
If you have a considerable amount of data to send you can have many sentences that end with \n which is just another character.
The end is \0
|
|
|
Goto Forum:
Current Time: Fri Sep 20 20:52:18 CEST 2024
Total time taken to generate the page: 0.02977 seconds
|
|
|