Re: [twsocket] Client and Server at same time?
Can't remember. I've since moved on, seperating the client and server, and have now run into a new issue that I'll post about soon (this new issue is probably something very easy for those that are used to ICS) Wilfried Mestdagh wrote: > Hello Michael, > > I dont see in your example that you assign an event handler to > OnSessionAvaialble, so I dont think TriggerSessionAvailable will cause > an exception. But what is exacly the error ? > > --- > Rgds, Wilfried [TeamICS] > http://www.overbyte.be/eng/overbyte/teamics.html > http://www.mestdagh.biz > > Thursday, January 5, 2006, 03:33, Michael Preslar wrote: > >> Good catch. > >> Now it crashes in WSocket.pas at the "end;" of procedure >> TCustomWSocket.TriggerSessionAvailable(Error : Word); -- 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
Re: [twsocket] Client and Server at same time?
Hello Michael, I dont see in your example that you assign an event handler to OnSessionAvaialble, so I dont think TriggerSessionAvailable will cause an exception. But what is exacly the error ? --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Thursday, January 5, 2006, 03:33, Michael Preslar wrote: > Good catch. > Now it crashes in WSocket.pas at the "end;" of procedure > TCustomWSocket.TriggerSessionAvailable(Error : Word); > KL Chin wrote: >> Hi, >> >> You code not complete. You did not create the socket. >> >>socket := TWScoket.Create( ); >> >> >> constructor TClient.Create; >> begin >> inherited; >> (* This part crashes *) >> sock >> socket.OnDataAvailable := SocketDataAvailable; >> socket.OnSessionClosed := SocketSessionClosed; >> end; -- 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
Re: [twsocket] Client and Server at same time?
Hi, IMHO it will be better for you to do a copy and paste method by drop TWScocket component to your main form, then prepare all the required events, then copy/move the code to the TClient. Regards KL Chin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Michael Preslar Sent: Thursday, January 05, 2006 10:34 AM To: ICS support mailing Subject: Re: [twsocket] Client and Server at same time? Good catch. Now it crashes in WSocket.pas at the "end;" of procedure TCustomWSocket.TriggerSessionAvailable(Error : Word); KL Chin wrote: > Hi, > > You code not complete. You did not create the socket. > >socket := TWScoket.Create( ); > > > constructor TClient.Create; > begin > inherited; > (* This part crashes *) > sock > socket.OnDataAvailable := SocketDataAvailable; > socket.OnSessionClosed := SocketSessionClosed; > end; -- 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 -- 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
Re: [twsocket] Client and Server at same time?
Good catch. Now it crashes in WSocket.pas at the "end;" of procedure TCustomWSocket.TriggerSessionAvailable(Error : Word); KL Chin wrote: > Hi, > > You code not complete. You did not create the socket. > >socket := TWScoket.Create( ); > > > constructor TClient.Create; > begin > inherited; > (* This part crashes *) > sock > socket.OnDataAvailable := SocketDataAvailable; > socket.OnSessionClosed := SocketSessionClosed; > end; -- 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
Re: [twsocket] Client and Server at same time?
Hi, You code not complete. You did not create the socket. socket := TWScoket.Create( ); constructor TClient.Create; begin inherited; (* This part crashes *) sock socket.OnDataAvailable := SocketDataAvailable; socket.OnSessionClosed := SocketSessionClosed; end; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Michael Preslar Sent: Thursday, January 05, 2006 10:11 AM To: twsocket@elists.org Subject: [twsocket] Client and Server at same time? Hello.. I'm working on a program that could be either a client and/or a server at the same time. Well, wanting to work on it. Going by the ICS examples, I've put together some code that should work. I have a: type TClient = class(TObject) Peer : String; Socket : TWSocket; constructor Create; procedure SocketDataAvailable(Sender: TObject; Error: Word); procedure SocketSessionClosed(Sender: TObject; Error: Word); private buffer : ansistring; public AcceptForm : TForm; Reference : Pointer; PortNum: Integer; peername : TSockAddrIn; end; then in TClient.create I do begin inherited; socket.OnDataAvailable := SocketDataAvailable; socket.OnSessionClosed := SocketSessionClosed; end; Which crashed the program. What's the proper way to do this? Full source to an example program can be found at http://www.mpcode.com/cliserv.zip (its d6 code, but should be fine with anything that runs ICS and Delphi) -- 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 -- 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