• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 470
  • Last Modified:

TServerSocket sendtext char by char

I need to test app 'A' (for which I do not have the code) which has a TCP client connection -- by passing messages to it and waiting for responses.  I have written a test app 'B' (in D5) using the TServerSocker component - the problem however is that when I connect to the client app 'A' and use my app 'B' sendtext method to send a message string, the comms window on app 'A' shows the chars being received one-by-one (slowly) rather than the whole string being read.  
If however I take a second copy of app 'A' and configure as a server (in INI), in order to get both of them talking, they send and receive complete strings in their comms windows OK.
What could cause this behaviour? Could this be that app 'A' is using winsock API methods directly? Am I to consider sendbuff instead? Please advise, thanks.
0
brenlex
Asked:
brenlex
  • 3
  • 3
1 Solution
 
MerijnBSr. Software EngineerCommented:
Do you have any more information on the protocol?
Can you show a little bit of code you use to send the data?

> I have written a test app 'B' (in D5) using the TServerSocker component

I don't understand this, you are connecting to app 'A' right? Shouldn't you be a client and not a server?
0
 
brenlexAuthor Commented:
App 'A' can be configured as client or server -- I configured as 'client' for testing. My app 'B' (containing a TServerSocket component configured as NonBlocking) is run up, listens for connection attempt from app 'A', and then sends using basic method:

for i := 0 to (iActiveConns-1) do
  ServerSocket1.Socket.Connections[i].SendText(sMsgToSend);

When I created an app 'C' containing a TClientSocket it receives the text string from app 'B' OK. It is only when I sendtext from app 'B' to app 'A' that I get the 'char-by-char' behaviour.
0
 
MerijnBSr. Software EngineerCommented:
This seems quite strange.

> Am I to consider sendbuff instead?

No use, SendText calls SendBuff internally.

I don't have much experience with TServerSocket, I'd suggest you use wireshark or another sniffer to see the difference between you sending to the client, and the original app sending to the client.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
PeterInghamCommented:
Does the behavior change if you run A (as Client) and B on the same machine/ different machines on the same LAN?
0
 
brenlexAuthor Commented:
I have tried running app 'B' on localhost, from a Virtual PC session and from a test machine on the same LAN -- always the same behaviour.
0
 
MerijnBSr. Software EngineerCommented:
Did you check with a sniffer?

If you can't find anything, I'd suggest you try another tcp stack implementation, just to experiment.
0
 
brenlexAuthor Commented:
Just for ref - figured it out. It appeared that app 'A' was reading complete strings and looking for an ETX at the tail end of the string... if one was not present, it would write char by char!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now