Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Client - Server Socket

Status
Not open for further replies.

kristof

Programmer
Jun 2, 2000
234
BE
Hi all,

I'm building two applications.
One server application, and one client application.

The server app will be constantly running, while the clients connect to it.

When a client connects, a message will appear on the server like this: 'IP-address' has connected.

Then, the server will send a message to the client saying that the connection was successfull. This is displayed within the client program.

All this works fine, but as soon as the client receives the 'success' message, an EListError is thrown.
(List index is out of bounds)

I know that that is a String/Array type of error, but I don't understand why it would throw it. [dazed]

Any help?

Thx,

Kristof
 
It could be just about anything, so you need to narrow it down a little.

The number that you get with the "List index out of bounds" dialog tells you what the offending list index was. That may give you a hint.

Set a bunch of breakpoints in your program in and above the suspect code, and/or step through with F8 and F7. If Delphi has the blue highlight sitting on a particular bar and you press F8 and then it throws the exception, then you know that it was that line (or a function called from that line) that caused the problem. Zoom in on the problem this way.

If you can nail it down to a particular line, and that line has several statements on it, break 'em up, so Delphi can narrow it down that little bit more for you. Or break up a complicated line like:
Code:
    s := myStringList[0] + myStringList[1];
into smaller simpler lines like:
Code:
    m0 := myStringList[0];
    m1 := myStringList[1];
    s := m0 + m1;
, which may also serve to narrow it down.
Use Run | Add Watch to watch a few values as you step through, and see if they really contain what you thought they contained. In the above example, I'd be watching myStringList.Count and myStringList.CommaText. Inside a loop, I might be watching myStringList.

-- Doug Burbidge mailto:doug@ultrazone.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top