Home » U++ Library support » U++ MT-multithreading and servers » [SOLVED] A problem with TcpSocket::GetLine()
Re: A problem with TcpSocket::GetLine() [message #41422 is a reply to message #41420] |
Mon, 16 December 2013 01:26 |
Oblivion
Messages: 1093 Registered: August 2007
|
Senior Contributor |
|
|
Quote: |
Bug identified & fixed. Should work now.
Mirek
P.S.: POP3 package would be handy..
|
Thanks Mirek! I've updated the U++ source, and now it works.
I will upload the POP3 class before the new year. But before that, I will clean up the code and write the api documentation. It is a straightforward POP3 implementation meant to accompany SMTP.
However, I have another question and problem regarding TcpSocket::GetLine():
GetLine() also fails if there are any multibyte characters in the socket buffer. In SocketClient and SocketServer examples, just Put("İŞĞÜÖÇişğüöç\n") and you'll see that it fails. Is this intended, or a bug?
Quote: |
#include <Core/Core.h>
using namespace Upp;
String Request(const String& r)
{
TcpSocket s;
if(!s.Connect(CommandLine().GetCount() ? CommandLine()[0] : "127.0.0.1", 3214)) {
Cout() << "Unable to connect to server!\n";
SetExitCode(1);
return Null;
}
// s.Put(r + '\n');
// The following line cannot be read by SocketServer.
s.Put("testing TcpSocket:GetLine(): İŞĞÜÖÇişöçüğ\n");
s.Timeout(5000);
return s.GetLine();
}
// Start reference/SocketServer before starting this program
CONSOLE_APP_MAIN
{
Cout() << Request("time") << '\n';
Cout() << Request("33") << '\n';
}
|
Regards.
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
|
|
|
Goto Forum:
Current Time: Sun Apr 28 02:40:53 CEST 2024
Total time taken to generate the page: 4.03835 seconds
|