Solved

Delay in TClientSocket and TServerSocket Components....

Posted on 2001-08-03
6
405 Views
Last Modified: 2010-04-06
I'm new to TClientSocket and TServerSocket Components in Delphi 4.  What I tried to do was a simple program just connecting and sending a simple string message from client exe to server exe via winsocket.  However, either connection or sending message was incredibly slow, taking a few seconds.  It wasn't like it in VB or VC++.  Am I making some mistakes using these components?  

Could anyone help?  

0
Comment
Question by:skyrider_tieus
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:h_mohsenian
ID: 6351357
there is a good Demo for Using TServerSocket & TClienSocket in Delphi. see Demoes\Internet\Chat\Chat App. it used SendText for sending Message.

best regards
hamed
0
 

Author Comment

by:skyrider_tieus
ID: 6360735
hamed:

Thanks for the tip.  Sending string message was OK, but the connection was still slow.  The demo program had some bugs.  If two instances were running in the same machine, an error message would appear 'Windows socket error (10048), on API bind'.  Despite this error message, they still worked except for the slow connection.  When an instance exited, another error message showed up saying 'Access violation'.  I was running two instances on the same PC.  Is there a way to expidite the connection?

James
0
 

Author Comment

by:skyrider_tieus
ID: 6360885
This issue is solved.  TCustomWinSocket.remotehost property would take a while to resolve the remote host name.  The winsocket would run much faster without invoking this property.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Accepted Solution

by:
Moondancer earned 0 total points
ID: 6361167
Points have been refunded.  This is now moved to our PAQ.
Moondancer
Community Support Modertor @ Experts Exchange
0
 
LVL 1

Expert Comment

by:h_mohsenian
ID: 6362714
hi skyrider_tieus , i am glad that you find your need, but about demo bug :

if i understand right , you say : if you run two of this demo App in one computer and when you want to connect , an error is happend, i think it is not a bug becouse each app want to get Net stream in the same port , it means to process want to use the one resource , it must be make error. it is not a bug , this a app work when you have a Lan for example and each app runs with each computer with determined IP .

if i am in wrong way about understanding your mean please tell me!

why you want to exec two App in one PC , is a test simulation?

best regards
hamed
0
 

Author Comment

by:skyrider_tieus
ID: 6365870
hamed:

Thank you again for the follow-up comment.  Yes, you are right about the cause of the first error, which occurs owing to two instances competing for the same resource.  I am still unware of what has caused the second error. I guess when Inprise developed this demo they did not take this case into account.  The chat program should run astride the LAN.  

Yes, it is a test simulation for inter-process communication between two programs with different programing languages.  Winsocket is not the best means though, it is the quickest and simplest.

James
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question