Thread View: borland.public.cppbuilder.internet.socket
4 messages
4 total messages
Started by Vladimir Stefanovic
Tue, 10 Aug 2004 18:55
Send/Receive MemoryStream with sockets
Author: Vladimir Stefanovic
Date: Tue, 10 Aug 2004 18:55
Date: Tue, 10 Aug 2004 18:55
31 lines
1711 bytes
1711 bytes
Hi, I know that this has been discussed many times before, but can someone please spend some time and help me with the code that sends data from TClientSocket to TServerSocket? On the client side the data to be sent is in: TMemoryStream object, say MSO, and has this struct (if it is of any importance at all): %s\t%s\t%s\t%s\t%s\r\n ... (and so on - pairs of 5 strings separated by TABs + CRLF) On the server side, I want to receive the data into (for example) another TMemoryStream object. How can I do that? I saw many times that the data has to be sent in small pieces ( BYTE buff[100] ), and someone says that buffer has to be less than 8192 bytes. What are the advantages and disadvantages of sending 100 in comparison to pieces of 8192 bytes? Is there any need that the buffer is configurable? Best regards, Vladimir Stefanovic
Re: Send/Receive MemoryStream with sockets
Author: Remy Lebeau (TeamB)
Date: Tue, 10 Aug 2004 20:44
Date: Tue, 10 Aug 2004 20:44
18 lines
1361 bytes
1361 bytes
"Vladimir Stefanovic" <spam@not.needed> wrote in message news:41191a2c@newsgroups.borland.com... > can someone please spend some time and help me > with the code that sends data from TClientSocket to > TServerSocket? First, are you using blocking or non-blocking sockets? It makes a big difference for the coding. > I saw many times that the data has to be sent in > small pieces ( BYTE buff[100] ) That is not a requirement. Gambit
Re: Send/Receive MemoryStream with sockets
Author: Vladimir Stefanovic
Date: Wed, 11 Aug 2004 04:16
Date: Wed, 11 Aug 2004 04:16
13 lines
1484 bytes
1484 bytes
> First, are you using blocking or non-blocking sockets? It makes a big > difference for the coding. I making a simple email resending service. In the OnExecute() the service is checking if there is something to be sent, and feeding the service with data is intended to be via TClient/Server socket. I tried with 'ctNonBlocking' and TServerSocket responded to my requests even when the progam was stucked into OnExecute(). Best regards, Vladimir Stefanovic
Re: Send/Receive MemoryStream with sockets
Author: Vladimir Stefanovic
Date: Wed, 11 Aug 2004 07:14
Date: Wed, 11 Aug 2004 07:14
50 lines
2233 bytes
2233 bytes
Hi,
Correction. In my country it was about 06:15
when I answered you so I completely missed the
point about sending modes you asked me. Sory.
This is what I wanted to accomplish:
I want to make simple email sending service.
The service itself has a container class, which
internaly is consisted of series of TStringLists,
so adding new request in the list is like this:
ToBeSent->Add ( FromAddress, FromName, Subject,
ToAddress, Body );
The main Service's OnExecute() is processing that
list something like this /simplified/:
while ( ToBeSent->Count > 0 )
{
if ( SendEmail ( FIFO ) )
TakeSomeAction(); // Remove from list, etc
else
TakeSomeOtherAction(); // LOG
}
In the meantime the TServerSocket is supposed to
receive new requests for sending and when finished
receiving one package of data (sent from one client):
while ( !EndOfFileOfOnePackage )
{
// ...
ToBeSent->Add ( FromAddress, FromName, Subject,
ToAddress, Body );
}
At that particular moment other clients which eventually
wants to send request should wait, I think.
Please help me with your oppinion.
Best regards,
Vladimir Stefanovic
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads