As a few of my other posts are mentioning, I'm building an application where many computers across a network can each connect to each other and test bandwidth speeds between each other. It's purpose is to analyze a network (and eventually draw lines on a map) to identify where certain speeds are good/bad. That much is way down the road, but I'm just trying to get the first version done.
Anyway, I'm posting this thread, not necessarily as a specific problem, but rather asking for any input or recommendations, specifically on how to structure the sockets, packets, commands, etc.
I pretty much already have a working version of just the raw sockets, which can currently just connect and log in. Easy enough. I'm just using the TServerSocket and TClientSocket. It's a multi part system. There are two major pieces:
Server - provides single master connection to provide info about other clients on the network which any client can connect to for testing
Client - two pieces:
- Service - two tasks - Runs as a windows service and does all the core testing.
- Connects to master Server for listing of other clients it can connect to
- Connects to other clients to test ping/speed
- (Also allows incoming connections from local applications which need to interact)
- Application - Can run multiple instances, attaches to local Service to send/receive commands
(All my projects are prefixed with JD, and this is NetSpeed, so everything starts with 'JDNS')
I've built wrappers for the sockets:
- TJDNSServerSocket: TComponent
- with TServerSocket
- TJDNSClientSocket: TComponent
- with TClientSocket
- TJDNSSocket: TObject
- with TCustomWinSocket
I'm sure at least one person will mention NOT to use ScktComp but I already have a bunch of stuff pre-built for them.
For example, when the Client connects to the Server, the Client's expected to immediately log in. From the Client component, you would just simply call SendLogin('MyUsername', 'MyPassword'); Then, on the server, the Server component will trigger an event OnLoginRequest(Sender: TObject; Client: TJDNSSocket; const User, Pass: String; var Allow: Bool); Whatever procedure is called for this event will do the actual validation outside the component, then pass 'Allow := True;' to accept it. The server would then send back the result to the client, and the Client will trigger a corresponding event OnLoginReply(Sender: TObject; Client: TJDNSSocket; const Allow: Bool);
Similar deal when sending any command...
My goal is to make these 3 classes reusable. The TJDNSSocket can be used in both the Server and the Client for managing basic session level interaction.
Lost yet? Don't feel bad, I'm the one coding this thing and I'm getting lost...
ANY input would be appreciated, small or big, dumb or genius, simple or complex, feasible or far-fetched, whatever it may be.
JD Solutions
Anyway, I'm posting this thread, not necessarily as a specific problem, but rather asking for any input or recommendations, specifically on how to structure the sockets, packets, commands, etc.
I pretty much already have a working version of just the raw sockets, which can currently just connect and log in. Easy enough. I'm just using the TServerSocket and TClientSocket. It's a multi part system. There are two major pieces:
Server - provides single master connection to provide info about other clients on the network which any client can connect to for testing
Client - two pieces:
- Service - two tasks - Runs as a windows service and does all the core testing.
- Connects to master Server for listing of other clients it can connect to
- Connects to other clients to test ping/speed
- (Also allows incoming connections from local applications which need to interact)
- Application - Can run multiple instances, attaches to local Service to send/receive commands
(All my projects are prefixed with JD, and this is NetSpeed, so everything starts with 'JDNS')
I've built wrappers for the sockets:
- TJDNSServerSocket: TComponent
- with TServerSocket
- TJDNSClientSocket: TComponent
- with TClientSocket
- TJDNSSocket: TObject
- with TCustomWinSocket
I'm sure at least one person will mention NOT to use ScktComp but I already have a bunch of stuff pre-built for them.
For example, when the Client connects to the Server, the Client's expected to immediately log in. From the Client component, you would just simply call SendLogin('MyUsername', 'MyPassword'); Then, on the server, the Server component will trigger an event OnLoginRequest(Sender: TObject; Client: TJDNSSocket; const User, Pass: String; var Allow: Bool); Whatever procedure is called for this event will do the actual validation outside the component, then pass 'Allow := True;' to accept it. The server would then send back the result to the client, and the Client will trigger a corresponding event OnLoginReply(Sender: TObject; Client: TJDNSSocket; const Allow: Bool);
Similar deal when sending any command...
Code:
//Server receives command from client - event triggered by server socket
procedure TJDNSServer.SvrCommand(Sender: TObject; Client: TJDNSSocket; const Command: Integer; const Data: String);
begin
case Command of
CMD_CLIENT_LIST: begin
//Send back list of all clients
end;
CMD_CLIENT_DETAIL: begin
//Send back details of requested client
end;
CMD_PING_BEGIN: begin
//Send beginning of ping test
end;
CMD_PING_SEND: begin
//Send single ping packet
end;
end;
end;
My goal is to make these 3 classes reusable. The TJDNSSocket can be used in both the Server and the Client for managing basic session level interaction.
Lost yet? Don't feel bad, I'm the one coding this thing and I'm getting lost...
ANY input would be appreciated, small or big, dumb or genius, simple or complex, feasible or far-fetched, whatever it may be.
JD Solutions