[twsocket] Sending Record Type Data over tcp
My record type is like; TData = record age: integer; end; PData = ^TData; I send data as follows succesfully; Send(Data, SizeOf(TData)); and receive; Receive(Data, SizeOf(TData)); What i want to do is to send a couple of record types (seperately); and distinguish them on the client side. i tried moving data into a PChar variable, ant put some distinguisher in front of data, but this didnt worked out, or i couldnt.. Can someone help me out? Thanks.. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Sending Record Type Data over tcp
Yes, Im using TCP. I solved my problem (at least in here) with replacing Move() into CopyMemory() I'm using LineMode, to receive all data sent. (My data size is 49b in total and no string data in it) Are there any conflicts i may encounter in the approach stated below? (I intend to replace Rcvd variable with a global one to prevent having allocating it in every receive) Thank you for help and kind replies.. procedure TMainForm.WSocket1DataAvailable(Sender: TObject; ErrCode: Word); var Rcvd: PChar; RcvdSize: integer; Data: PStatus; begin if ErrCode 0 then exit; GetMem(Rcvd, 128); with (Sender as TWSocket) do try RcvdSize := Receive(Rcvd, 128); if RcvdSize 0 then exit; case Ord(Rcvd[0]) of // Choose data type 0: begin New(Data); try CopyMemory(Data, @Rcvd[1], SizeOf(TStatus)); ... except Dispose(Data); end; end; 1: begin ... end; end; finally FreeMem(Rcvd); end; end; -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Package Count / Wireshark
i used wireshark to monitor activity on the port i m listening on.Protocol is TCP and the server was build with ICS TWSocketServer. Monitoring packages arrived, I see that one of the packages (505 byte) is divided into 3 packages. What i want to ask; is this the way tcp protocol transfers data over network, or package count is because of the method client uses to send data..? ... Can we make a package transfered in a whole (in size limitations) or tcp decides how to transfer data by itself? The reason i am in this case is not the package count, but the headers used to form a package which makes data count increase.. Thanks.. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] The address that client is connected (2 or more IPs assinged to server)
I have two IPs assigned to server machine. And TWSocketserver working with Addr = 0.0.0.0 can i resolve the ip address that the client is connected. For example 2 clients, first is connecting to address 10.100.10.1, second is connecting to 10.100.10.2 But two of them is hosted with same server. I want to find which is connecting to 10.100.10.1.. Thank you for all help .. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] The address that client is connected (2 or more IPs assinged to server)
Thank you. This will help me much. 2010/2/12 Lester les...@lesterclayton.com Use Client.GetXAddr Example: procedure TFTPServer.SslFtpServer1ClientConnect(Sender: TObject; Client: TFtpCtrlSocket; AError: Word); Var Msg : String; begin // Code Msg := 'Connection on IP ' + Client.GetXAddr + ' and port ' + Client.GetXPort + ' by client at '+ Client.GetPeerAddr+':'+ Client.GetPeerPort; // Code end; Lester Alper Albayrak wrote: I have two IPs assigned to server machine. And TWSocketserver working with Addr = 0.0.0.0 can i resolve the ip address that the client is connected. For example 2 clients, first is connecting to address 10.100.10.1, second is connecting to 10.100.10.2 But two of them is hosted with same server. I want to find which is connecting to 10.100.10.1.. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be