Hello...

I am really stumped.  I am attempting to write some testing applications
that will test the performance of some TCP/IP transport components that I
have written.  My components use TWSocket components for the TCP/IP
interface and implement an encrypted, packetizing stream over TCP/IP.

The test is real simple.  I am just trying to see how many connections per
second I can make with the components.  The problem is that the server and
the client report different results for the number of connections and I CAN
NOT figure out why?!?!?!  I think the problem is my approach to writing the
test applications, but I can't figure what where the problem is?!?!?

Basically, there are two testing applications, one is a server and one is
client.  The test is just to see how many connections (sessions) can be
generated during a given period, e.g. per second.  The test is really
simple, actually, which is what is stumping me.

The Server works this way:
1. The server starts and immediately enters listening on a port.
2. Whenever the server receives a client connection, I increment a connect
count.  I do this in the Server's OnClientConnect event.
3. Whenever the server receives a client disconnect, I increment a
disconnect count.  I do this in the Server's OnClientDisconnect event.

That is it for the server, other than a few minor functions, like letting
the user manually clear the counts via a button on the form.

The Client works this way:
1. The user sets a few controls (length of test, port, etc).
2. The user starts the start via a button.
3. A test flag is set and a system timer is started.
4. The Client initiates a connection to the server.
5. When the client gets a connection, I increment a connect counter and
close the connection.  I do this in the OnSessionConnected event.  I close
the connection by posting a message to my main form, which in turn closes
the connection.  This way, I don't close the connection from the Client
Socket's message handler.
6. In the Client's OnSessionClosed event, I check to see if the test has
finished.  The test is finished when the timer has fired and a flag is
cleared.  If it has not finished, then I initiate another connection to the
server.  I do this by posting a message to the main form, which in turn
starts the connection, so that I don't start the connection it in the Client
Socket's message handler.

There are two problems with this:

1. The count of connections on the server and the count of connections on
the client will sometimes be off by a few.  Not always, but most of the
time.  The first test will usually be same, say 128 on both ends.  But,
subsequent tests will be off by two or three, like server = 131 and client =
129.  I do not understand this.  Is this just an inherent problem with
windows socket messages and how I have implemented the test?  Perhaps, there
are pending messages in the socket que that haven't been processed or
something?  I am concerned that I am missing an event or something.

2. Even though I use local messages to start and stop the connections, the
Client application will not process any other messages unless I call
Application.Processmessages, which I call in the OnSessionConnected event.
If I do not call ProcessMessages, the timer event never fires and the test
just runs forever or until I close the Server, then the Client application
processes messages and stops the test.  If I am doing the connects and
disconnects using posted messages to the form, then why don't other messages
get processed as well?  Why is it looping in the TWSocket event handlers
only? That is rather odd.

I hope this makes sense.  Is there a better way to implement this test?  Do
I just not understand the windows socket message handling enough to
understand why this isn't working?

I am tempted to just ignore the difference in counts, but I am concerned
that there is an underlying flaw in how I am using the TWSocket components
and I am concerned that I have a bug that I am not aware of in my
components.

Any input would be appreciated.  Thanks much.

Hoby

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to