Re: [twsocket] UDP Problem

2013-01-08 Thread Jack Moran
I believe I have installed the packages correctly. The Overbyte samples work 
perfectly. When I went to my own application, I had to manually put the VC32 
folder in the library path. The application compiles okay, but WSocket is nil 
on the first call (similar to the SendButtonClick procedure) and I get an out 
of range error.

On Jan 7, 2013, at 12:17 PM, Arno Garrels arno.garr...@gmx.de wrote:

 Jack Moran wrote:
 That's probably my problem. How do I install ICS? I'm just adding
 files to the project. 
 
 I'm using Delphi XE2 and ICS Gold.
 
 Quoted from ReadMe7.txt:
 
 {code}
 INSTALLATION USING THE INSTALL PROJECT GROUPS
 For each Delphi and C++ Builder version one project group is provided in 
 directory
 .\Install:
 
 Delphi 7 :  D7Install.bpg
 Delphi 2006  :  D2006Install.bdsgroup
 Delphi 2007  :  D2007Install.groupproj
 Delphi 2009  :  D2009Install.groupproj
 Delphi 2010  :  D2010Install.groupproj
 Delphi XE:  DXeInstall.groupproj
 Delphi XE2   :  DXe2Install.groupproj
 Delphi XE3   :  DXe3Install.groupproj
 C++ Builder 2006 :  CB2006Install.bdsgroup
 C++ Builder 2007 :  CB2007Install.groupproj
 C++ Builder 2009 :  CB2009Install.groupproj
 C++ Builder 2010 :  CB2010Install.groupproj
 C++ Builder XE   :  CBXeInstall.groupproj
 C++ Builder XE2  :  CBXe2Install.groupproj
 C++ Builder XE3  :  CBXe3Install.groupproj
 
 1 - Do a File/Open Project, navigate to the Install directory, select the 
 correct
 file and open it. The project manager view should now display two package
 projects, one run-time and one design-time package. The run-time package name
 contains the Run suffix. The design-time package name contains the Design
 suffix.
 2 - Select and Build the run-time package (do not install).
 3 - Select and Install the design-time package.
 
 After a few seconds, you should have a dialog box telling you the package has
 been installed with a bunch of new components registered in the Tool Palette
 under Overbyte ICS and Overbyte ICS SSL. Then do a Save All and a 
 Close All.
 {code}
 
 If you need ICS for FireMonkey get ICSv8 downloadable from:
 http://wiki.overbyte.be/wiki/index.php/ICS_Download
 and you must install DXe2InstallVclFmx.groupproj instead.
 
 --
 Arno
 
 --
 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


Re: [twsocket] UDP Problem

2013-01-08 Thread Jack Moran
Never mind! I see now I had to add the WSocket from the pallet.

On Jan 7, 2013, at 12:17 PM, Arno Garrels arno.garr...@gmx.de wrote:

 Jack Moran wrote:
 That's probably my problem. How do I install ICS? I'm just adding
 files to the project. 
 
 I'm using Delphi XE2 and ICS Gold.
 
 Quoted from ReadMe7.txt:
 
 {code}
 INSTALLATION USING THE INSTALL PROJECT GROUPS
 For each Delphi and C++ Builder version one project group is provided in 
 directory
 .\Install:
 
 Delphi 7 :  D7Install.bpg
 Delphi 2006  :  D2006Install.bdsgroup
 Delphi 2007  :  D2007Install.groupproj
 Delphi 2009  :  D2009Install.groupproj
 Delphi 2010  :  D2010Install.groupproj
 Delphi XE:  DXeInstall.groupproj
 Delphi XE2   :  DXe2Install.groupproj
 Delphi XE3   :  DXe3Install.groupproj
 C++ Builder 2006 :  CB2006Install.bdsgroup
 C++ Builder 2007 :  CB2007Install.groupproj
 C++ Builder 2009 :  CB2009Install.groupproj
 C++ Builder 2010 :  CB2010Install.groupproj
 C++ Builder XE   :  CBXeInstall.groupproj
 C++ Builder XE2  :  CBXe2Install.groupproj
 C++ Builder XE3  :  CBXe3Install.groupproj
 
 1 - Do a File/Open Project, navigate to the Install directory, select the 
 correct
 file and open it. The project manager view should now display two package
 projects, one run-time and one design-time package. The run-time package name
 contains the Run suffix. The design-time package name contains the Design
 suffix.
 2 - Select and Build the run-time package (do not install).
 3 - Select and Install the design-time package.
 
 After a few seconds, you should have a dialog box telling you the package has
 been installed with a bunch of new components registered in the Tool Palette
 under Overbyte ICS and Overbyte ICS SSL. Then do a Save All and a 
 Close All.
 {code}
 
 If you need ICS for FireMonkey get ICSv8 downloadable from:
 http://wiki.overbyte.be/wiki/index.php/ICS_Download
 and you must install DXe2InstallVclFmx.groupproj instead.
 
 --
 Arno
 
 --
 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


[twsocket] UDP Problem

2013-01-07 Thread Jack Moran
I am having a problem with OverbyteIcsUdpSend. On compilation I get a message 
Field MainForm.Wsocket does not have a corresponding component. Remove the 
declaration? I say No, but then get an access violation at 0x00544c24 when it 
tries to set Wsocket. I've tried both the XE2 and XE3 versions.
--
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] UDP Problem

2013-01-07 Thread Jack Moran
That's probably my problem. How do I install ICS? I'm just adding files to the 
project. 

I'm using Delphi XE2 and ICS Gold.

On Jan 7, 2013, at 11:42 AM, Arno Garrels arno.garr...@gmx.de wrote:

 Jack Moran wrote:
 I am having a problem with OverbyteIcsUdpSend. On compilation I get a
 message Field MainForm.Wsocket does not have a corresponding
 component. Remove the declaration? I say No, but then get an access
 violation at 0x00544c24 when it tries to set Wsocket. I've tried both
 the XE2 and XE3 versions.
 
 Sounds like ICS is not installed in the IDE.
 What version of ICS and Delphi do you use?
 
 -- 
 Arno
 --
 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


Re: [twsocket] UDP Problem

2013-01-07 Thread Jack Moran
Thanks, Arno. I completely missed the read me file. It's working fine now. I 
appreciate the excellent support.

On Jan 7, 2013, at 12:17 PM, Arno Garrels arno.garr...@gmx.de wrote:

 Jack Moran wrote:
 That's probably my problem. How do I install ICS? I'm just adding
 files to the project. 
 
 I'm using Delphi XE2 and ICS Gold.
 
 Quoted from ReadMe7.txt:
 
 {code}
 INSTALLATION USING THE INSTALL PROJECT GROUPS
 For each Delphi and C++ Builder version one project group is provided in 
 directory
 .\Install:
 
 Delphi 7 :  D7Install.bpg
 Delphi 2006  :  D2006Install.bdsgroup
 Delphi 2007  :  D2007Install.groupproj
 Delphi 2009  :  D2009Install.groupproj
 Delphi 2010  :  D2010Install.groupproj
 Delphi XE:  DXeInstall.groupproj
 Delphi XE2   :  DXe2Install.groupproj
 Delphi XE3   :  DXe3Install.groupproj
 C++ Builder 2006 :  CB2006Install.bdsgroup
 C++ Builder 2007 :  CB2007Install.groupproj
 C++ Builder 2009 :  CB2009Install.groupproj
 C++ Builder 2010 :  CB2010Install.groupproj
 C++ Builder XE   :  CBXeInstall.groupproj
 C++ Builder XE2  :  CBXe2Install.groupproj
 C++ Builder XE3  :  CBXe3Install.groupproj
 
 1 - Do a File/Open Project, navigate to the Install directory, select the 
 correct
 file and open it. The project manager view should now display two package
 projects, one run-time and one design-time package. The run-time package name
 contains the Run suffix. The design-time package name contains the Design
 suffix.
 2 - Select and Build the run-time package (do not install).
 3 - Select and Install the design-time package.
 
 After a few seconds, you should have a dialog box telling you the package has
 been installed with a bunch of new components registered in the Tool Palette
 under Overbyte ICS and Overbyte ICS SSL. Then do a Save All and a 
 Close All.
 {code}
 
 If you need ICS for FireMonkey get ICSv8 downloadable from:
 http://wiki.overbyte.be/wiki/index.php/ICS_Download
 and you must install DXe2InstallVclFmx.groupproj instead.
 
 --
 Arno
 
 --
 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


[twsocket] Seeking OO design suggestions

2007-05-27 Thread Jack

I'm planning on implementing a set of test classes to test multiple servers
speaking various protocols (for example: HTTP, SMTP, and proprietary
protocols.) There are multiple servers of each type. I use some very simple
protocol-aware packets to check if the ports are open and if the servers
are functional. For each type of server, I use multiple (say, 10) async
sockets to connect to the servers to speed up testing.

I'm thinking about two different ways of implement it, both trying to
share as much code as possible.

Design 1. Have socket classes derived from TWSocket, implement the protocol
specific logic in those class, and share a common master class to create
multiple socket instances for each protocol. The master class
(TServerTester) creates different tester sockets based on an argument
in the constructor.

Socket classes have the socket event handlers and do protocol-specific
testing:
  THttpTesterSocket = class(TWSocket) // with http event handlers
...
  end;
  
  TSmtpTesterSocket = class(TWSocket) // with smtp event handlers
...
  end;

  TServerTester = class(TObject) // A common master tester class
 Sockets: TObjectList;
 ...
  end;


Or, design 2. Have one simple class derived from TWSocket, or just use TWSocket
for socket, no event handled in this class. And have a base Tester class
to create sockets. This class declare socket event handlers for the
sockets it creates. Then derive protocol-specific Tester classes and
override the event handlers:

  TTesterSocket = class(TWSocket) // very simple no event handlers
...
  end;

  TServerTester = class(TObject)  // create and delete sockets for one
Sockets: TObjectList;  // protocol, dummy event handlers)
...
  end;
  
  THttpServerTest = class(TServerTester) // with event handler implementation
...
  end;
  
  TSmtpServerTest = class(TServerTester) // with event handler implementation
...
  end;

I'm not very clear about which is better for this job. I'm open
to other suggestions as well.

-- 
Thanks!
Jack

-- 
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] Pause and Resume

2007-03-28 Thread Jack
Hello Francois,

It seems that the sole purpose of passing FComponentOptions in
ASyncReceive() is for Do_FD_CLOSE() to call without wsoNoReceiveLoop.
I see two places where ASyncReceive() is called. In the other place
Do_FD_READ(), FComponentOptions is passed in without modification.

So I suggest we remove MySocketOptions from ASyncReceive() arguments,
and add bForceLoop flag as an argument of ASyncReceive(). When bForceLoop
is set by Do_FD_CLOSE(), we do not check wsoNoReceiveLoop. If
bForceLoop is not set (in the case of Do_FD_READ) we use FComponentOptions
directly, instead of MySocketOptions, in ASyncReceive() function.

procedure TCustomWSocket.ASyncReceive(ErrCode: Word; bForceLoop : Boolean);
begin
  ...
  if (not bForceLoop) and (wsoNoReceiveLoop in FComponentOptions) then
break;
  ...
end;

Does this make sense to you?

-- 
Best regards,
Jack

Monday, March 19, 2007, 12:51:00 AM, you wrote:

 Would you consider patching my changes into ICS?

 If you look at each call to AsyncReceive, you'll see that some (Do_FD_CLOSE)
 doesn't pass FComponentOptions. So your patch can't be applyed as is without
 impacting the behaviour and compromising the component.

 The change has to be clever to affect only Do_FD_READ.

 Contribute to the SSL Effort. Visit
 http://www.overbyte.be/eng/ssl.html
 --
 [EMAIL PROTECTED]
 Author of ICS (Internet Component Suite, freeware)
 Author of MidWare (Multi-tier framework, freeware)
 http://www.overbyte.be


 - Original Message - 
 From: Jack [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Sunday, March 18, 2007 9:43 PM
 Subject: Re: [twsocket] Pause and Resume


 Hello Wilfried and Francois,

 Would you consider patching my changes into ICS?

 -- 
 Best regards,
 Jack

 Sunday, March 18, 2007, 5:17:12 AM, you wrote:

  Hello Jack,

  This seems OK. Indeed if you set wsoNoreceivedLoop in the
  OnDataAvailable handler it will hot have an effect when there is still
  data to receive and with this fix it is.

  Another possibility is that you set wsoNoreceivedLoop beforehand at
  creation time of TWSocket, then you dont need the change.

 -- 
 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] Pause and Resume

2007-03-18 Thread Jack
Hello Wilfried and Francois,

Would you consider patching my changes into ICS?

-- 
Best regards,
Jack

Sunday, March 18, 2007, 5:17:12 AM, you wrote:

 Hello Jack,

 This seems OK. Indeed if you set wsoNoreceivedLoop in the
 OnDataAvailable handler it will hot have an effect when there is still
 data to receive and with this fix it is.

 Another possibility is that you set wsoNoreceivedLoop beforehand at
 creation time of TWSocket, then you dont need the change.

-- 
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


[twsocket] Pause and Resume

2007-03-17 Thread Jack

I had a problem of not being able to pause the socket in a proxy
type of application, when the client is sending from the local
machine. I tried both Pause() and wsoNoReceiveLoop option. The socket
will eventually pause, but it only happens after a few MByte data
is received.

I might have found the problem of the socket not being paused.
I'm trying both Pause() function and wsoNoReceiveLoop. Pause()
makes sure I'm not interested in read event, and wsoNoReceiveLoop
is suppose to make sure that we break out of the receive loop.
However, the client (receiving) socket won't be able to pause until
a few MBytes of data is received.

This seems to be causing the problem: in the ASynReceive,
the wsoNoReceiveLoop is checked against MySocketOptions, which
is passed in the function and won't change until all data is
received. If we use the member variable FComponentOptions, whose
value can be set in the OnDataReceived handler. This way the
loop can be effectively broken out of.

The reason to use the function argument MySocketOptions instead of
FComponentOptions is that in Do_FD_CLOSE() we want to look through
the data (because there may not be another chance Receive() is called.)

So my quick fix is:

1. use FComponentOptions in ASyncReceive()

procedure TCustomWSocket.ASyncReceive(
   ...
{ DLR Honor the socket options being passed as parameters }
//if wsoNoReceiveLoop in MySocketOptions then
if wsoNoReceiveLoop in FComponentOptions then
break;
   ...
end;

2. In Do_FD_CLOSE(), remove wsoNoReceiveLoop flag in the member
variable.

procedure TCustomWSocket.Do_FD_CLOSE(var msg: TMessage);
  ...
FComponentOptions := FComponentOptions - [wsoNoReceiveLoop];
ASyncReceive(0, FComponentOptions - [wsoNoReceiveLoop]);
  ...
end;

Please let me know if you see issues in this fix.
-- 
Best regards,
Jack

-- 
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


[twsocket] Some changes IFDEF-ed out?

2007-03-07 Thread Jack
Hello ,

When I look at the twsocket.pas code, I notice that some changes
are not in effect. This one, for example, requires TOMASEK to be
defined. Is there any reason for this?

function TCustomWSocket.TriggerDataAvailable(ErrCode : Word) : Boolean;
var FSelectEventTemp: LongInt;
begin
Result := Assigned(FOnDataAvailable);
if not Result then
Exit;
{$IFDEF TOMASEK}{ 23/01/99 }
{ Do not allow FD_READ messages, this will prevent reentering the }
{ OnDataAvailable event handler.  }
{FSelectEvent := FD_WRITE or FD_CLOSE or FD_CONNECT;
WSocket_Synchronized_WSAASyncSelect(FHSocket, Handle, WM_ASYNCSELECT, 
FSelectEvent);}
FSelectEventTemp := FSelectEvent and (not FD_READ);
WSocket_Synchronized_WSAASyncSelect(FHSocket, Handle, WM_ASYNCSELECT, 
FSelectEventTemp);
try
  ...

-- 
Best regards,
Jack

-- 
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] Pause, Resume and wsoNoReceiveLoop

2007-01-17 Thread Jack
Hello Wilfried,

I'm not sure if I have understood you. I'm using one thread
to do everything, and I'm calling Pause in OnClientDataAvailabe()
on the client socket spawned by the server socket. Could you
please explain a bit more?

-- 
Best regards,
Jack

Tuesday, January 16, 2007, 6:48:06 AM, you wrote:

 Hello Jack,

 It's a while ago, but possible OnDataAvailable is fired when you call
 Pauze. If this is the reason you can set a flag to call it only 1 time.

 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz


-- 
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


[twsocket] Pause, Resume and wsoNoReceiveLoop

2007-01-16 Thread Jack
This is definitely the first time I ask about this topic.
Not the second time, either. I guess I'm just dumb enough
to not be able to get it all working even after reading
many replies to my earlier questions :)

May problem again, is that I have a port forwarder type of
application. Local clients send to my server, and the server
forward the traffic to remote servers. Because the local client
can send real fast, the data will be cached in twsocket's internal
send buffer. Sometimes, it reaches a few hundred MBytes, which is
not good. My solution to this is to pause local client traffic if
the BufferedByteCount of remote socket is above 8192 bytes.
Here is the code:

procedure TComm.WSocketServerClientDataAvailable(Sender: TObject; Error: Word);
begin
  ...
  len := Receive(@DataRcv, 65536);
  ...
  if TransportSocket.BufferedByteCount  8192 then
  begin
Log('Client paused ID=' + IntToStr(Id) + ' BufferedByteCount=' + 
IntToStr(TransportSocket.BufferedByteCount));
TClientSocket(Sender).ComponentOptions := ComponentOptions + 
[wsoNoReceiveLoop];
TClientSocket(Sender).Pause;
exit;
  end;
  ...
end;

However, the client socket does not seem to pause, as I'm seeing
tons of these entries in my log window (paused but not really paused):

  Client paused ID=7 BufferedByteCount=22878
  Client paused ID=7 BufferedByteCount=22878
  Client paused ID=7 BufferedByteCount=22878
  Client paused ID=7 BufferedByteCount=22878
  Client paused ID=7 BufferedByteCount=22878
  
I'm also logging Resume() calls but according to the log, Resume()
were not called when the Pause() calls happened.

Not wanting to waste others' time replying to me again, I dig the
old emails on this matter and read them again but couldn't find what
I'm doing wrong. Below are some excerpts from past emails. It could
be compiled in one of the wiki pages.


-- 
Best regards,
Jack



[From Francios]

It (Pause) suppress async notification. So you don't receive events anymore
but I/O continue as much as winsock can, for example filling his receive buffer.

You can't ignore OnDataavailable event ! If you don't call Receive from
OnDataAvailable event, the event will be triggered again and again until
you read the data. You'll enter an infinite loop. Calling Pause will stop
OnDataAvailable from being triggered, ...

Pause only affect winsock notification. It stops notifications from winsock
but if data is already in, you have to read it.
Try the option wsoNoReceiveLoop, it may help to stop delivering of already 
received data. If you use the option and pause the socket, you will not be 
notified of any data already received and waiting in the buffer. So when you 
resume, you should probably call Receive once to check for remaining data.

wsoNoReceiveLoop tell the component to not loop until the message queue has
no more FD_READ messages. When a loop is done (default) the component 
receive data as fast as possible. This maybe result is heavy load on the 
computer when the network is very fast compared to the CPU speed.

It (wsoNoReceiveLoop) shouldn't have any impact on the high level protocol,
except speed.

Speaking about your application: are you sure you still receive data ? From
OnDataAvailable event handler, you must receive everything or you enter an 
infinite loop when wsoNoReceiveLoop is not activated and if activated but 
you don't call Receive, then you don't get any notification before you cxall 
Receive.

If you call Pause, obviously you are no more notifyed when data comes in. 
This will fill the receive buffer until full and at that time the peer will 
recive the zero window message. Before timeout you must call resume and 
probably Receive as well to restart the receiving process.


[From Wilfried]

- Pause will stop notification from winsock. If there is already data
  received then OnDataAvailable will keep on firing for a while until
  you have received.

  After that winsock buffer will fill but no notification. When winsock
  buffer is full then sender will stop sending data.

- Resume will turn notification back on, so filled up receive buffer
  from winsock will fire onDataAvailable again.

- if you set wosNoReceivedLoop and you do NOT receive in OnDataAvaliable
  then it will also not fire again until you call receive. This means
  that you have to call Receive outside the OnDataAvailable to turn it
  on again.

- A combination of both should be working also. You call pause, and when
  you are in paused state you dont want to receive even if there is
  already somethign to receive as you explained in a previous mail. Then
  you do the wsoNoReceivLop;

  I think if combine both, and you call Resume that OnDataAvailable
  will fire again without calling Receive outside of it. You can try it
  easely of course. Pleas let us know, this is valuable information.

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo

Re: [twsocket] wsoNoReceiveLoop problem with bandwidth limiting

2007-01-01 Thread Jack
Hi Francois,

 As far as I know, TCP zero window is sent when the comiter is not able to
 receive data anymore because the receive buffer is full. And still as far as
 I know this is not an error if it doesn't persist for too long. It is simply
 part of the control flow in TCP protocol.

 Speaking about your application: are you sure you still receive data ? From
 OnDataAvailable event handler, you must receive everything or you enter an
 infinite loop when wsoNoReceiveLoop is not activated and if activated but
 you don't call Receive, then you don't get any notification before you cxall
 Receive.

Yes, without wsoNoReceiveLoop, I'm able to receive the whole 200MB
file. With wsoNoReceiveLoop, it breaks in the middle. It's yet to
find out why

I think my code works similarly to httpprot, with the exception
of having wsoNoReceiveLoop commented out. The client receives everything
in the OnDataAvailable handler, calculates the bandwith, if too high,
calls Pause. Then in a timer, when the average bandwidth drops, Resume
is called.

You and Wilfried explained that wsoNoReceiveLoop stops the loop.
I thought Pause does this as well? When Pause is called, am I supposed
to get OnDataAvailable events? I guess I'm not clear on how
wsoNoReceiveLoop interacts with Pause and Resume.

 If you call Pause, obviously you are no more notifyed when data comes in.
 This will fill the receive buffer until full and at that time the peer will
 recive the zero window message. Before timeout you must call resume and
 probably Receive as well to restart the receiving process.

Yes, resume is called in a timer handler, similar to httpprot.


-- 
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


[twsocket] Fwd: Re[2]: wsoNoReceiveLoop problem with bandwidth limiting

2007-01-01 Thread Jack

Just to add a bit to the description of the problem - the
problem only happens when wsoNoReceiveLoop is used.

- The connection is not closed but there's no data coming in.
  This typically happens after a few MByte of data has been
  transferred.
  
- I log Pause and Resume calls so that I see them rolling in
  DebugView window. When the problem happens, no more pause
  and resume show in the log window The last one is always
  a Resume. So, when the problem happens, it seems that either
  the TCP stack fails to receive more data, or the TWSocket
  object fails to call OnDataAvailable event.

- I could not reproduce the problem with httpprot component.
  (I could only test httpprot against a web server, which is a
  different server box with different OS. Not sure if it has
  anything to do with the difference in TCP stacks. One Windows,
  one Linux + proprietary software)

===8==Original message text===
Hi Francois,

 As far as I know, TCP zero window is sent when the comiter is not able to
 receive data anymore because the receive buffer is full. And still as far as
 I know this is not an error if it doesn't persist for too long. It is simply
 part of the control flow in TCP protocol.

 Speaking about your application: are you sure you still receive data ? From
 OnDataAvailable event handler, you must receive everything or you enter an
 infinite loop when wsoNoReceiveLoop is not activated and if activated but
 you don't call Receive, then you don't get any notification before you cxall
 Receive.

Yes, without wsoNoReceiveLoop, I'm able to receive the whole 200MB
file. With wsoNoReceiveLoop, it breaks in the middle. It's yet to
find out why

I think my code works similarly to httpprot, with the exception
of having wsoNoReceiveLoop commented out. The client receives everything
in the OnDataAvailable handler, calculates the bandwith, if too high,
calls Pause. Then in a timer, when the average bandwidth drops, Resume
is called.

You and Wilfried explained that wsoNoReceiveLoop stops the loop.
I thought Pause does this as well? When Pause is called, am I supposed
to get OnDataAvailable events? I guess I'm not clear on how
wsoNoReceiveLoop interacts with Pause and Resume.

 If you call Pause, obviously you are no more notifyed when data comes in.
 This will fill the receive buffer until full and at that time the peer will
 recive the zero window message. Before timeout you must call resume and
 probably Receive as well to restart the receiving process.

Yes, resume is called in a timer handler, similar to httpprot.

-- 
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


[twsocket] wsoNoReceiveLoop problem with bandwidth limiting

2007-01-01 Thread Jack
I finally found the problem. In OnDataAvailable, in one of
the cases Receive() did not read all the available data.

===8==Original message text===

Just to add a bit to the description of the problem - the
problem only happens when wsoNoReceiveLoop is used.



-- 
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] wsoNoReceiveLoop problem with bandwidth limiting

2006-12-31 Thread Jack
Thanks Francois and Wilfried for the replies.

I still have no clue why it's causing TCP stack to send
TCP zero window to the server... basically when the zero
window packet shows up, the connection will break.

-- 
Best regards,
Jack

Sunday, December 31, 2006, 12:59:40 AM, you wrote:

 So, my question is, what is wsoNoReceiveLoop for

 wsoNoReceiveLoop tell the component to not loop until the message queue has
 no more FD_READ messages. When a loop is done (default) the component
 receive data as fast as possible. This maybe result is heavy load on the
 computer when the network is very fast compared to the CPU speed.

 (and why does it work in my case without setting it), and is
 it safe to not set it?

 It shouldn't have any impact on the high level protocol, except speed.

 --
 Contribute to the SSL Effort. Visit
 http://www.overbyte.be/eng/ssl.html
 --
 [EMAIL PROTECTED]
 http://www.overbyte.be



 - Original Message - 
 From: Jack [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Sunday, December 31, 2006 8:20 AM
 Subject: [twsocket] wsoNoReceiveLoop problem with bandwidth limiting



 I borrowed some code from HttpProt.pas to limit bandwidth
 in my application. My application is a client socket talking
 to a server in a proprietary protocol. When I download a large
 file, the connection always break. When I observe the traffic
 in Ethereal, I see many error (in red and black) packets saying
 TCP zero window being sent to the server when it happens.
 I suspect it has something to do with wsoNoReceiveLoop option,
 Pause and Resume. I then disabled the code calling Pause and
 Resume, but left this line in,

  ComponentOptions := ComponentOptions + [wsoNoReceiveLoop];

 the problem remained. I then took the above line out, and
 left Pause and Resume in, I was able to complete the download.

 So, my question is, what is wsoNoReceiveLoop for (and why does
 it work in my case without setting it), and is it safe to not
 set it?

 -- 
 Best regards,
 Jack

 -- 
 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


[twsocket] wsoNoReceiveLoop problem with bandwidth limiting

2006-12-30 Thread Jack

I borrowed some code from HttpProt.pas to limit bandwidth
in my application. My application is a client socket talking
to a server in a proprietary protocol. When I download a large
file, the connection always break. When I observe the traffic
in Ethereal, I see many error (in red and black) packets saying
TCP zero window being sent to the server when it happens.
I suspect it has something to do with wsoNoReceiveLoop option,
Pause and Resume. I then disabled the code calling Pause and
Resume, but left this line in,

  ComponentOptions := ComponentOptions + [wsoNoReceiveLoop];

the problem remained. I then took the above line out, and
left Pause and Resume in, I was able to complete the download.

So, my question is, what is wsoNoReceiveLoop for (and why does
it work in my case without setting it), and is it safe to not
set it?

-- 
Best regards,
Jack

-- 
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


[twsocket] TWSocket support for HTTP proxy

2006-12-09 Thread Jack
Thanks Francois for uploading and updating the file.

Francois also asks me to explain a little what's done in the modification.

It's actually similar to the socks support. Instead of using a socks4
or socks5 proxy, the changes allow a socket to tunnel through HTTP proxy that
supports the CONNECT method. Basic authentication scheme is supported.
I tried to mimic the existing socks support code and add http proxy
support in parallel. Please note that some HTTP proxy server
configurations do not support CONNECT method on none-443 ports.

The changes are for ICS version 5 beta. Many people (Team ICS and the
list members) know ICS and Delphi much better than I do. It would be
great for you to review the changes to make sure I'm doing it right :)

Below are some issues that I can think of. Some are in my modification
some in the existing code for socks proxy support, which will take
more time to improve, and I am not the right person to fix it really.

- socks and SSL support in existing ICS code is not done in the ideal way.
  As it is now, a socket is either an SSL socket or a socks socket. An SSL
  connection should also also be able to go through a proxy server,
  but not with the current code. The SSL support should ideally be on top
  of proxy (socks or http proxy) support.
  
- http proxy support is added in parallel to socks, and http processing
  is done after socks processing in the code. Only one type of proxy
  (socks or http) can be used in one socket. This design of course will
  not support proxy chaining. Ideally, proxy support should be flexible
  enough to chain any number of socks and http proxies that support
  CONNECT method.

- the modification supports Basic authentication scheme only,
  and does not support Digest authentication scheme (quite some work :)

- Once HTTP header is received, I'm reading one byte a time to read
  the rest of the reply, which is not the most efficient way. Since
  it's mostly reading from a buffer in memory, it should not be a big
  deal. This has no impact if HTTP proxy is not in use.


-- 
Best regards,
Jack

Saturday, December 9, 2006, 1:13:30 AM, you wrote:

 Updated today.

 --
 Contribute to the SSL Effort. Visit
 http://www.overbyte.be/eng/ssl.html
 --
 [EMAIL PROTECTED]
 http://www.overbyte.be


 - Original Message - 
 From: Francois PIETTE [EMAIL PROTECTED]
 To: twsocket@elists.org
 Sent: Friday, December 08, 2006 8:27 PM
 Subject: [twsocket] TWSocket support for HTTP proxy


 Jack has patched the latest beta (Downloaded about a week ago) to have
 TWSocket support http proxy tunneling. I've uploaded the file at
 http://www.overbyte.be/arch/dump/WSocketHttpProxy.zip for everyone review.


-- 
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] TWSocket support for HTTP proxy

2006-12-09 Thread Jack
Hello Arno,

If you have tested it, I could be wrong. I didn't actually test it.
I just looked at the code below and it seems that SSL and Socks are
mutually exclusive. I didn't dig it further.

{$IFDEF USE_SSL}  { Makes the IDE happy }
  TBaseParentWSocket = TCustomSslWSocket;
{$ELSE}
  TBaseParentWSocket = TCustomSocksWSocket;
{$ENDIF}

-- 
Best regards,
Jack

Saturday, December 9, 2006, 9:59:17 AM, you wrote:

 Hello Jack,

 [..]
 - socks and SSL support in existing ICS code is not done in the ideal
 way.   As it is now, a socket is either an SSL socket or a socks
 socket. An SSL   connection should also also be able to go through a
 proxy server,   but not with the current code.

 Hmm, this worked fine in the past, but I have not tested Socks with SSL since
 a long time, so changes in the SSL code since that time may have broken it,
 if you say that Socks with SSL doesn't work in current versions I will
 reactivate my Socks5 box tomorrow to run a test again. 

 ---
 Arno Garrels [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html



 The SSL support should
 ideally be on top   of proxy (socks or http proxy) support.
 
 - http proxy support is added in parallel to socks, and http
 processing   is done after socks processing in the code. Only one
 type of proxy   (socks or http) can be used in one socket. This
 design of course will   not support proxy chaining. Ideally, proxy
 support should be flexible   enough to chain any number of socks and
 http proxies that support   CONNECT method.
 
 - the modification supports Basic authentication scheme only,
   and does not support Digest authentication scheme (quite some work
 :) 
 
 - Once HTTP header is received, I'm reading one byte a time to read
   the rest of the reply, which is not the most efficient way. Since
   it's mostly reading from a buffer in memory, it should not be a big
   deal. This has no impact if HTTP proxy is not in use.
 
 
 --
 Best regards,
 Jack
 
 Saturday, December 9, 2006, 1:13:30 AM, you wrote:
 
 Updated today.
 
 --
 Contribute to the SSL Effort. Visit
 http://www.overbyte.be/eng/ssl.html
 --
 [EMAIL PROTECTED]
 http://www.overbyte.be
 
 
 - Original Message -
 From: Francois PIETTE [EMAIL PROTECTED]
 To: twsocket@elists.org
 Sent: Friday, December 08, 2006 8:27 PM
 Subject: [twsocket] TWSocket support for HTTP proxy
 
 
 Jack has patched the latest beta (Downloaded about a week ago) to
 have TWSocket support http proxy tunneling. I've uploaded the file
 at http://www.overbyte.be/arch/dump/WSocketHttpProxy.zip for
 everyone review. 

-- 
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] TWSocket support for HTTP proxy

2006-12-09 Thread Jack
Hello Arno,

Got it. Now I declare that my earlier comment on SSL and
using a proxy is officially INVALID :)

Although I am a contributor to the SSL project but I have
to admit that I have never looked at the SSL code ;-p

-- 
Best regards,
Jack

Saturday, December 9, 2006, 10:25:52 AM, you wrote:

 Hello Jack,

 Hello Arno,
 
 If you have tested it, I could be wrong. I didn't actually test it.
 I just looked at the code below and it seems that SSL and Socks are
 mutually exclusive. I didn't dig it further.
 
 {$IFDEF USE_SSL}  { Makes the IDE happy }
   TBaseParentWSocket = TCustomSslWSocket;
 {$ELSE}
   TBaseParentWSocket = TCustomSocksWSocket;
 {$ENDIF}

 That's totally OK, TCustomSslWSocket is derived from TCustomSocksWSocket.
 Don't you have the SSL code?

 ---
 Arno Garrels [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html


 
 --
 Best regards,
 Jack
 
 Saturday, December 9, 2006, 9:59:17 AM, you wrote:
 
 Hello Jack,
 
 [..]
 - socks and SSL support in existing ICS code is not done in the
 ideal way.   As it is now, a socket is either an SSL socket or a
 socks socket. An SSL   connection should also also be able to go
 through a proxy server,   but not with the current code.
 
 Hmm, this worked fine in the past, but I have not tested Socks with
 SSL since a long time, so changes in the SSL code since that time
 may have broken it, if you say that Socks with SSL doesn't work in
 current versions I will reactivate my Socks5 box tomorrow to run a
 test again. 
 
 ---
 Arno Garrels [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 
 
 
 The SSL support should
 ideally be on top   of proxy (socks or http proxy) support.
 
 - http proxy support is added in parallel to socks, and http
 processing   is done after socks processing in the code. Only one
 type of proxy   (socks or http) can be used in one socket. This
 design of course will   not support proxy chaining. Ideally, proxy
 support should be flexible   enough to chain any number of socks and
 http proxies that support   CONNECT method.
 
 - the modification supports Basic authentication scheme only,
   and does not support Digest authentication scheme (quite some work
 :)
 
 - Once HTTP header is received, I'm reading one byte a time to read
   the rest of the reply, which is not the most efficient way. Since
   it's mostly reading from a buffer in memory, it should not be a
 big   deal. This has no impact if HTTP proxy is not in use.
 
 
 --
 Best regards,
 Jack
 
 Saturday, December 9, 2006, 1:13:30 AM, you wrote:
 
 Updated today.
 
 --
 Contribute to the SSL Effort. Visit
 http://www.overbyte.be/eng/ssl.html
 --
 [EMAIL PROTECTED]
 http://www.overbyte.be
 
 
 - Original Message -
 From: Francois PIETTE [EMAIL PROTECTED]
 To: twsocket@elists.org
 Sent: Friday, December 08, 2006 8:27 PM
 Subject: [twsocket] TWSocket support for HTTP proxy
 
 
 Jack has patched the latest beta (Downloaded about a week ago) to
 have TWSocket support http proxy tunneling. I've uploaded the file
 at http://www.overbyte.be/arch/dump/WSocketHttpProxy.zip for
 everyone review.

-- 
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


[twsocket] Throttling solution - Integrate Dan's throttler into ICS?

2006-12-09 Thread Jack

Although throttling has been brought up many times, I'm still
in search for a simple throttling mechanism for my single-threaded
server app.

I just did a search in my emails, and found the following mentioning
of throttling:

Dan [EMAIL PROTECTED] has a wrapper for TWSocket class:
http://www.xantorrent.pwp.blueyonder.co.uk/ics/uThrottledWSocket.pas

There is a link here but the link to the code is broken, so I don't
know how it works:
http://www.smatters.com/ics/

Dan's class would work if I'm using a TWSocket class directly.
However, I'm actually using a TWSocketServer class, which in turn
instantiates TWSocketClient class, which inherits from TWSocket. So, in
order to use Dan's throttler, I'll have to change ICS code quite
a bit, which I don't intent to do (for ease of ICS upgrade.)

I'm using a single threaded server, so multi-threaded throttling
mechanism won't be applicable.

It sounds like a good idea to integrate Dan's throttler into ICS,
if Dan and Francois agree. What do others say? Or, is there any
easier ways to throttle the TWSocketClient class?

-- 
Best regards,
Jack

-- 
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] Error 10058 when not sending?

2006-11-29 Thread Jack
Hello Wilfried,

Thanks for your reply. Do you mean I should check the ErrCode in the
event handlers, if none-zero, check LastError? When will BGException
be fired exactly? I suppose it could happen even when no event handler is
called?

Jack

 I think you have to check your event handlers for exception. BGException
 is fired when exception comes from the message pump. But most event
 handlers are fired from the message pump as well.


-- 
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


[twsocket] Error 10058 when not sending?

2006-11-28 Thread Jack
 TComm.WSocketServerClientBgException 128 10058

So it seems that The exceptions cause the incomplete fetches. Error
10058 means Cannot send after socket shutdown. I'm not sure why this
happens because the request has been sent already by the time the exception
happens and partial page has been fetched.

11/28/2006 3:34:12 AM TTransportSocket: Close ID=123
11/28/2006 3:34:12 AM TComm.WSocketServerClientBgException 123 10058

The first line above means the transport socket receives a command
from the server to close this client socket. Right after which, the
10058 error happens. I don't know what the client is trying to send
at this time.

Same thing for these two exceptions:
11/28/2006 3:34:25 AM TTransportSocket: Close ID=132
11/28/2006 3:34:26 AM TTransportSocket: Close ID=128
11/28/2006 3:34:27 AM TComm.WSocketServerClientBgException 132 10058
11/28/2006 3:34:27 AM TComm.WSocketServerClientBgException 128 10058

So the question is, what sending causes this problem? Can any of
the TCP psh, fin, ack, etc. packets cause this problem? Could it be
that the connection is closed before an ACK is sent back? It shouldn't
be though because w/o getting a proper ACK, the server shouldn't be
disconnecting.


-- 
Best regards,
Jack

-- 
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] HttpCli ContentRangeBegin

2006-11-21 Thread Jack

It is actually for data integrity as well (more than security, in my
opinion.) When it comes to large file download, there might be corrupted
bytes. Then this is more likely caused by HD errors then network errors.

 Conclusion: I think data corruption might be a problem in some cases.
 Notice how all Linux distributions include MD5 hashes for all downloads,
 so they can be checked on the receiving end?

 This is not to detect data corrumption because of data transmission but to
 detect man in the middle attack. MD5 checksum allow the user to check if
 the data file he downloaded is the same as the data file the developper
 dropped on the server and was not replaced either on the server or by
 someone intercepting the communication.

 In think in the context you mention, MD5 is used for security, no for data
 integrity.


-- 
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] Receive() returns -1

2006-11-09 Thread Jack
Hello Arno,

Thanks for the reply. It turned out that there's some data in the
buffer and my code didn't pick it up, because the code calculate
the protocol data wrong. Once it's fixed, this problem stopped
happening. Although I am still curious why the error -1, but I
didn't bother to trace it down :)

-- 
Best regards,
Jack

Thursday, November 9, 2006, 1:16:28 AM, you wrote:

 Arno Garrels wrote:
 Jack wrote:
 Hello all,
 
 I have a TCP socket client. In some cases, OnDataReceived()
 
 There's no such event in ICS named OnDataReceived.
 
 gets fired for multiple times with ErrCode = 0, but when I call
 Receive() the return value is always -1 so the application can
 not read any data back.
 
 If that happens in TWSocket's OnDataAvailable event it means that
 the connection was closed, just ignore it, OnSessionClosed will
 be triggered later on.

 Sorry mixed it up with with a 0 result 0 means a closed connection,
 -1 means an error, check LastError.  

 
 ---
 Arno Garrels [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 
 
 Because OnDataReceived() keeps getting fired,
 this freezes the application. Any idea why this is happening?
 In my particular case, the buffer is valid and has a size of
 48 bytes. The application does this operation repeatedly.
 The first time, or the first few times always work well.
 
 --
 Best regards,
 Jack

-- 
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


[twsocket] Receive() returns -1

2006-11-08 Thread Jack
Hello all,

I have a TCP socket client. In some cases, OnDataReceived()
gets fired for multiple times with ErrCode = 0, but when I call
Receive() the return value is always -1 so the application can
not read any data back. Because OnDataReceived() keeps getting fired,
this freezes the application. Any idea why this is happening?
In my particular case, the buffer is valid and has a size of
48 bytes. The application does this operation repeatedly.
The first time, or the first few times always work well.

-- 
Best regards,
Jack

-- 
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] Having a ICS TServiceApplication server survive a standby (slightly OT)

2006-10-30 Thread Jack
In applications you can handle the WM_POWERBROADCAST message but
I'm not sure if it works with a service.

-- 
Best regards,
Jack

Monday, October 30, 2006, 1:30:21 PM, you wrote:

 Hello Fastream,

 Could be XP bugs. I have done a few times a standby on XP and dont do it
 again as some services seems to stop working.

 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz

 Monday, October 30, 2006, 16:17, Fastream Technologies wrote:

 Hello,

 I wonder why this behavior occurs:

 - I have a service that runs in its own process
 - It works fine until I standby my WinXP Pro x64 Build 2003
 - When returns, it simply does not respond and could not be shut down
 using net stop ...--only task manager works.

 Any idea?

 Best Regards,

 SZ


-- 
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] A question about OnDataAvailable

2006-10-24 Thread Jack
I know I know :) I was trying to ask if I can get that info
without calling Receive() and ReceiveStr() :)

-- 
Best regards,
Jack

Tuesday, October 24, 2006, 12:37:37 AM, you wrote:

 Receive() and ReceiveStr() that you would normally be calling in
 OnDataAvailable returns the number of bytes.

 Best Regards,

 SZ

 On 10/24/06, Jack [EMAIL PROTECTED] wrote:
 Hi all,

 Is there a way to know how many bytes of data is available
 in the OnDataAvailable handler?

 --
 Best regards,
 Jack

 --
 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



 -- 
 Fastream Technologies
 Software IQ: Innovation  Quality
 www.fastream.com | Email: [EMAIL PROTECTED] | Tel: +90-312-223-2830

-- 
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] A question about OnDataAvailable

2006-10-24 Thread Jack
Hello Arno,

I expect to get a data record of N byte length. I'd like to wait
until the whole record has been received then I can call Receive()
to read it back. Otherwise, if a OnDataAvailable() is triggered
before the whole record is received, I will have to temporarily
store it somewhere and concatenate the data.

If RcvdCount is not reliable, I can probably use PeekData() but
this is not very efficient because the data might be copied twice
each by PeedData() and Receive();

-- 
Best regards,
Jack

Tuesday, October 24, 2006, 11:36:32 AM, you wrote:

 Francois PIETTE wrote:
 I know I know :) I was trying to ask if I can get that info
 without calling Receive() and ReceiveStr() :)
 
 var
Count : Integer;
 
 WSocket_ioctlsocket(WSocket1.HSocket, FIONREAD, Count);
 
 There is an article on MSDN which says this function is not reliable
 (http://support.microsoft.com/default.aspx?scid=kb;en-us;192599). See
 also comment dated Nov 26, 2000 (V4.25) in wsocket.pas.
 

 Now I remember. Usually you realy don't need to call it,
 Jack should explain why he wants to know how much data is pending
 w/o receiving it, sounds like a bad design.

 ---
 Arno Garrels [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html


 You have access to this value thru the property RcvdCount.
 
 --
 Contribute to the SSL Effort. Visit
 http://www.overbyte.be/eng/ssl.html --
 [EMAIL PROTECTED]
 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


[twsocket] A question about OnDataAvailable

2006-10-23 Thread Jack
Hi all,

Is there a way to know how many bytes of data is available
in the OnDataAvailable handler?

-- 
Best regards,
Jack

-- 
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] [OT] Borland Turbo

2006-09-07 Thread Jack
If you think about it, the whole point of having the free version
is to get people interested and get beginners started. Now they have to
create the components by code ... wise decision :) [OT]

 I'm really sad for Borland  another chance stupidly wasted... who
 was the genius that creates the non-extensibility idioturbo model

 Only for programmers that likes to run in a closet

 -Mensaje original-
 De: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] En
 nombre de Maurizio Lotauro
 Enviado el: Jueves, 07 de Septiembre de 2006 14:55
 Para: ICS support mailing
 Asunto: Re: [twsocket] [OT] Borland Turbo

 Scrive Mohit Sindhwani [EMAIL PROTECTED]:

 Hi!  I was just reading the press release about the Borland Turbo 
 products.. just started to download it (it's a lot!) but the Explore
 Edition is free (I think even for commercial apps) and I was wondering

 if anyone got their hands onto it before me!  Any idea if the ICS will

 work with it?

 The faq say that you can't add any thirdy party component to the
 explorer 
 version, so I expected that the asnwer to your question is no.


 Bye, Maurizio.

 
 This mail has been sent using Alpikom webmail system
 http://www.alpikom.it

 -- 
 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] OT; Delphi Turbo

2006-08-09 Thread Jack
However, it sounds like Borland is putting the limitations in the wrong
places in the free versions. Users can not install components into the
IDE? If it is what I think it is, that's taking the strength away from
tools like Delphi.

The MS VS Express editions' limitation is that you can not access
remote data. This is reasonable restriction for a student version.

-- 
Best regards,
Jack

Wednesday, August 9, 2006, 12:41:09 PM, you wrote:

 Angus Robertson - Magenta Systems Ltd wrote:
 Borland seems to be making some announcements today:

 Looks like an answer to the Express versions of M$ VS.
 Anyway Borlands IDE branche seems to be alive. That's
 really nice news.

 ---
 Arno Garrels [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 


-- 
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


[twsocket] Fwd: UDP SendTo() sends two packets?

2006-05-04 Thread Jack
Anyone has an answer for this one?

===8==Original message text===
I have the code to listen on a UDP port when the first button
is clicked, and send a packet when the second button is clicked.
It works fine except when the second button is clicked, it sends
two packets (I captured that with Ethereal.) Is there anything
I'm not doing right?

-- 
Best regards,
Jack


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, WinSock, WSocket;

type
  TForm1 = class(TForm)
WSocket1: TWSocket;
Memo1: TMemo;
Label1: TLabel;
Label2: TLabel;
btnSend: TButton;
edtDstIP: TEdit;
edtSvrPort: TEdit;
btnListen: TButton;
edtPort: TEdit;
procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
procedure btnSendClick(Sender: TObject);
procedure btnListenClick(Sender: TObject);
  private
{ Private declarations }
  public
{ Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btnListenClick(Sender: TObject);
begin
  WSocket1.Proto := 'udp';
  WSocket1.Port := edtSvrPort.Text;
  WSocket1.Addr := '0.0.0.0';
  WSocket1.Listen;
  btnListen.Enabled := False;
end;

procedure TForm1.btnSendClick(Sender: TObject);
var Src: TSockAddrIn; SrcLen: Integer;
begin
  Src.sin_family := AF_INET;
  Src.sin_addr.S_addr := inet_addr(PChar(edtDstIp.Text));
  Src.sin_port := hToNs(StrToInt(edtPort.Text));
  SrcLen := SizeOf(Src);
  WSocket1.SendTo(Src, SrcLen, PChar('Hello'), 5);
end;

procedure TForm1.WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
begin
  if ErrCode = 0 then Memo1.Lines.Add(WSocket1.ReceiveStr)
  else Memo1.Lines.Add('WSocket1DataAvailable() error = ' + IntToStr(ErrCode));
end;

end.

===8===End of original message text===

-- 
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


[twsocket] UDP SendTo() sends two packets?

2006-05-02 Thread Jack
I have the code to listen on a UDP port when the first button
is clicked, and send a packet when the second button is clicked.
It works fine except when the second button is clicked, it sends
two packets (I captured that with Ethereal.) Is there anything
I'm not doing right?

-- 
Best regards,
Jack


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, WinSock, WSocket;

type
  TForm1 = class(TForm)
WSocket1: TWSocket;
Memo1: TMemo;
Label1: TLabel;
Label2: TLabel;
btnSend: TButton;
edtDstIP: TEdit;
edtSvrPort: TEdit;
btnListen: TButton;
edtPort: TEdit;
procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
procedure btnSendClick(Sender: TObject);
procedure btnListenClick(Sender: TObject);
  private
{ Private declarations }
  public
{ Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btnListenClick(Sender: TObject);
begin
  WSocket1.Proto := 'udp';
  WSocket1.Port := edtSvrPort.Text;
  WSocket1.Addr := '0.0.0.0';
  WSocket1.Listen;
  btnListen.Enabled := False;
end;

procedure TForm1.btnSendClick(Sender: TObject);
var Src: TSockAddrIn; SrcLen: Integer;
begin
  Src.sin_family := AF_INET;
  Src.sin_addr.S_addr := inet_addr(PChar(edtDstIp.Text));
  Src.sin_port := hToNs(StrToInt(edtPort.Text));
  SrcLen := SizeOf(Src);
  WSocket1.SendTo(Src, SrcLen, PChar('Hello'), 5);
end;

procedure TForm1.WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
begin
  if ErrCode = 0 then Memo1.Lines.Add(WSocket1.ReceiveStr)
  else Memo1.Lines.Add('WSocket1DataAvailable() error = ' + IntToStr(ErrCode));
end;

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


[twsocket] Fwd: SO_REUSEADDR doesn't work

2006-04-28 Thread Jack

Please ignore this email. It turned out to be a messed up tcp stack.
The code works fine on other PC.

-- 
Best regards,
Jack

This is a forwarded message
From: Jack [EMAIL PROTECTED]
To: twsocket@elists.org
Date: Thursday, April 27, 2006, 4:48:45 PM
Subject: SO_REUSEADDR doesn't work

===8==Original message text===
Hello Francois and all,

I have a client socket. It has to use the same source port
(to avoid a problem on the server side.) It is supposed to
connect to a server from a specified source port, do something,
shutdown, and connect again. I checked the twsocket.pas file,
SO_REUSEADDR is used by default, so I should have no problem
reusing the source port. But I find that I can connect and do
things the first time, the second time OnSessoinConnect() always
returns 10048 error (specified address already in use.) When
I trace into twsocket.pas, bindSocket() doesn't really returns
an error. I wonder why I'm getting error 10048? I'm manually
calling Connect from a button for testing, not in any of the
twsocket message handlers.

-- 
Best regards,
Jack
===8===End of original message text===

-- 
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


[twsocket] SO_REUSEADDR doesn't work

2006-04-27 Thread Jack
Hello Francois and all,

I have a client socket. It has to use the same source port
(to avoid a problem on the server side.) It is supposed to
connect to a server from a specified source port, do something,
shutdown, and connect again. I checked the twsocket.pas file,
SO_REUSEADDR is used by default, so I should have no problem
reusing the source port. But I find that I can connect and do
things the first time, the second time OnSessoinConnect() always
returns 10048 error (specified address already in use.) When
I trace into twsocket.pas, bindSocket() doesn't really returns
an error. I wonder why I'm getting error 10048? I'm manually
calling Connect from a button for testing, not in any of the
twsocket message handlers.

-- 
Best regards,
Jack

-- 
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


[twsocket] httpcli does not work on dial-up connections?

2006-04-13 Thread Jack
Hello Francois and all,

Is there any chance that THttpCli doesn't work on dialup connections?
In one of our (remote) environment, the user has a dialup connection.
While he can browse with no problems with IE, httptst sample returns
an error of Failed: 404 Connection timed out (Error #10060) with any
web site. HttpTst sample works fine on highspeed on the same PC.

Any idea why this is happening?

-- 
Best regards,
Jack

-- 
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] httpcli does not work on dial-up connections?

2006-04-13 Thread Jack
Hmm. But windows firewall does not really block any outbound
requests. It only blocks servers ... correct me if I'm wrong.

Thursday, April 13, 2006, 10:14:59 AM, you wrote:

 Is there any chance that THttpCli doesn't work on dialup connections?
 In one of our (remote) environment, the user has a dialup connection.
 While he can browse with no problems with IE, httptst sample returns
 an error of Failed: 404 Connection timed out (Error #10060) with any
 web site. HttpTst sample works fine on highspeed on the same PC.
 
 Any idea why this is happening?
 


 Maybe Windows Firewall is active on the dialup but
 disabled on the highspeed connection? Open the WF
 control panel and look on the Advanced tab page.

-- 
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] Error 10053?

2006-04-05 Thread Jack
Hello Wilfried,

That's right, the client was connected without socket error.

On one of the PCs it happens persistently since recently.
(It didn't happen on that pc before.)

One another PC, it gets 10053 once in a while but it can be
a few dozen times a day.

On those PCs, other applications (IE, etc.) just run fine.
This has been puzzling me for a while ...

-- 
Best regards,
Jack

Wednesday, April 5, 2006, 11:12:43 AM, you wrote:

 Hello Jack,

 10053 is WSAECONNABORTED or in words: 'Software caused connection abort'
 witch means that the OS has decided to abort the connection due to some
 uknown reason. It is not nececary the OS, can also be a decision of a
 router.

 Question: You are getting connected without winsock error do you ?

 I have also seen this error because of software firewalls doing their
 job incorrect. Also seen it on large networks interconnected by routers
 where transport failures happens over the (leased) line.

 Hope this helps a little to determine where the problem could be ?

 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz

 Wednesday, April 5, 2006, 17:10, Jack wrote:

 Hi Francois and all,

 I have a client software. On some of the PC, when the client
 is connected to the server and wants to send some data, a twsocket
 OnSessionClosed() event is triggered with an error code of 10053.
 When this happens, it will happen again and again. Other applications
 like IE, firefox, email, etc. on the same PC seem to work fine.
 This problem didn't happen before even on this PC. And a similar
 problem happens on some other PC as well. Any idea what can cause
 this?

 -- 
 Best regards,
 Jack


-- 
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] ics under kylix ?

2006-03-20 Thread Jack
Hello Francois,

 There is a Kylix version available from http://www.overbyte.be.
 It is slightly different than the windows version since Linux
 doesn't support the same asynchronous
 programming model. Async operation has been implemented using multithreading.

I think Linux also supports async sockets using select. It is not
the same as on Windows (message-based) but as far as I know you don't
have to use multi-threading. As a matter of fact Windows also supports
the BSD sockets that works on Unix/Linux. ICS uses WinSock, not the
BSD socket API though. If ICS used BSD socket API, it won't take much
work porting it to Linux. Please correct me if I'm wrong.

-- 
Best regards,
Jack



-- 
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] send file to a http link or to a linux address using ICS

2006-03-16 Thread Jack
I find that the server side script may require different format.
When I did upload to a PHP page, I had to hand craft the MIME
content. It may not work with a non-PHP server side.

Jack

Thursday, March 16, 2006, 4:47:21 AM, you wrote:

 Is it possible to send a file from a windows machine from, lets
 say d:/testfile.txt to a weblink (like
 http://192.168.0.1/datas/upload/)
 or phisical address (like //192.168.0.1/datas/upload/) on linux using ICS?

 Assuming that I don't want to install FTP on linux server, is it still 
 possible?
 Do you know what is the best way to do this ?

 You have to write a script on the linux webserver to handle the
 post. Check you script by designing
 a web page with a HTML form with a INPUT TYPE=FILE to excercize
 your script using any browser. When
 the script is OK, you can use the ICS HTTP client component to do
 the same post as the browser do to
 upload the file.

 We already talked several times about file upload. Search the
 mailing list archive (link at the
 support page at my website).

 --
 Contribute to the SSL Effort. Visit
 http://www.overbyte.be/eng/ssl.html
 --
 [EMAIL PROTECTED]
 Author of ICS (Internet Component Suite, freeware)
 Author of MidWare (Multi-tier framework, freeware)
 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


[twsocket] Raw sockets doesn't capture broadcast UDP packets

2006-03-07 Thread Jack

Resending ... anyone has any idea why this is happening?

===8==Original message text===
Hello Francois,

I used the code you posted earlier to capture traffic with raw
sockets. It's the UDP packets I'm interested. It all works fine
with packets specifically addressed to this IP. However, all
broadcast packets are not captured, such as 192.168.1.255.
I tried a C++ library based on raw socket and it worked. I briefly
looked at the C++ code and didn't find anything obvious. Can you think
of any reason that the ICS raw sockets is not doing that?

WSocket1.ReqVerHigh   := 2;
WSocket1.ReqVerLow:= 2;
WSocket1.Proto:= 'raw_ip';
WSocket1.Port := '0';
WSocket1.ComponentOptions := [wsoSIO_RCVALL];
WSocket1.Addr := '192.168.1.102';
WSocket1.Listen;

-- 
Best regards,
Jack
===8===End of original message text===

-- 
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] Raw sockets doesn't capture broadcast UDP packets

2006-03-07 Thread Jack
Hello Arno,

I know about the components. They use ICS raw sockets. Because
ICS raw sockets does not capture broadcast packets, they don't
either :(

-- 
Best regards,
Jack

Tuesday, March 7, 2006, 9:58:59 AM, you wrote:

 Jack wrote:
 Resending ... anyone has any idea why this is happening?

 These components use ICS:
 http://www.magsys.co.uk/delphi/magmonsock.asp

 Raw sockets which are available with Windows 2000 and later.
 This uses WSocket from the François Piette internet component suite,
 from http://www.overbyte.be/. Major benefit is that no other
 software needs to be installed, but raw sockets don't seem to work
 fully with some network adaptors, and ignore non-IP protocols. Some
 adaptors may capture received packets, but ignore anything sent.

 ---
 Arno Garrels [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html


 
 ===8==Original message text===
 Hello Francois,
 
 I used the code you posted earlier to capture traffic with raw
 sockets. It's the UDP packets I'm interested. It all works fine
 with packets specifically addressed to this IP. However, all
 broadcast packets are not captured, such as 192.168.1.255.
 I tried a C++ library based on raw socket and it worked. I briefly
 looked at the C++ code and didn't find anything obvious. Can you think
 of any reason that the ICS raw sockets is not doing that?
 
 WSocket1.ReqVerHigh   := 2;
 WSocket1.ReqVerLow:= 2;
 WSocket1.Proto:= 'raw_ip';
 WSocket1.Port := '0';
 WSocket1.ComponentOptions := [wsoSIO_RCVALL];
 WSocket1.Addr := '192.168.1.102';
 WSocket1.Listen;
 
 --
 Best regards,
 Jack
 ===8===End of original message text===

-- 
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] Raw sockets doesn't capture broadcast UDP packets

2006-03-07 Thread Jack
Hello Arno,

 I tried a C++ library based on raw socket and it worked. I briefly
 looked at the C++ code and didn't find anything obvious.

 If you have the source it shouldn't be a big deal to find out the
 difference between TWsocket's and their API calls.

Yeah. I actually compared the part of the code that creates the
socket line by line and didn't notice any issues/major differences
between the C code and TWSocket...

Jack

-- 
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


[twsocket] Raw sockets doesn't capture broadcast UDP packets

2006-03-06 Thread Jack
Hello Francois,

I used the code you posted earlier to capture traffic with raw
sockets. It's the UDP packets I'm interested. It all works fine
with packets specifically addressed to this IP. However, all
broadcast packets are not captured, such as 192.168.1.255.
I tried a C++ library based on raw socket and it worked. I briefly
looked at the C++ code and didn't find anything obvious. Can you think
of any reason that the ICS raw sockets is not doing that?

WSocket1.ReqVerHigh   := 2;
WSocket1.ReqVerLow:= 2;
WSocket1.Proto:= 'raw_ip';
WSocket1.Port := '0';
WSocket1.ComponentOptions := [wsoSIO_RCVALL];
WSocket1.Addr := '192.168.1.102';
WSocket1.Listen;

-- 
Best regards,
Jack

-- 
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


[twsocket] TWSocketServer halts when freed

2006-03-04 Thread Jack
My application halts when WSocketServer is freed, not every time
though. But it happens once in a few times when the application is
closed. Here's the code snippet:

  if WSocketServer  nil then
  begin
WSocketServer.Abort();
Log('Server closed');
FreeAndNil(WSocketServer);
Log('Server freed');
  end;

When this happens, the last message I get is 'Server closed' so
it dies in FreeAndNil(WSocketServer); Log() just add a line in
a TMemo. They were added after this problem was seen.

I enabled Check for frozen main thread in madexcept and got
this report:

main thread ($728):
7c90eb94 + ntdll.dll  KiFastSystemCallRet
77d5f3de +0044 user32.dll SendMessageA
71ab8cc3 +489b WS2_32.dll WSACleanup
0048cdc4 +0018 Test.exe WSocket  1789  +2 
WSocket_Synchronized_WSACleanup
0048d5d9 +0035 Test.exe WSocket  2221 +12 WSocketUnloadWinsock
0048e2d7 +007f Test.exe WSocket  3507 +16 TCustomWSocket.Destroy
00493877 +0037 Test.exe WSocket  6378  +6 TCustomLineWSocket.Destroy
00494c0e +0092 Test.exe WSocketS  278 +15 TCustomWSocketServer.Destroy
00402e60 +0008 Test.exe SystemTObject.Free
00454be4 +0008 Test.exe SysUtils  FreeAndNil
0049e2ad +0031 Test.exe fTest 213  +5 TFrmTest.CleanUp
0049e148 +004c Test.exe fTest 133 +15 TFrmTest.FormClose


disassembling:
[...]
0048cdac 1787   cmp dword ptr [$4a5a14], 0
0048cdb3jnz loc_48cdc4
0048cdb5 1788   mov eax, $48cdd4   ; 'WSACleanup'
0048cdbacall+$979 ($48d738); WSocket.WSocketGetProc
0048cdbfmov [$4a5a14], eax
0048cdc4 1789  calldword ptr [$4a5a14]; WSACleanup (WS2_32.dll)
0048cdca 1790   ret


Anything I'm doing wrong?

-- 
Best regards,
Jack



-- 
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] TWSocketServer halts when freed

2006-03-04 Thread Jack
Hello Wilfried,

Thanks for the quick reply. No, I don't have a OnSessionClose or
OnChangeState handler. Destroying the server object will abort the
socket? Anyway, I also removed Abort() but the problem is still
happening from time to time as before.

-- 
Best regards,
Jack

Saturday, March 4, 2006, 1:21:05 AM, you wrote:

 Hello Jack,

 I read your mail better now :) No need for Abort. Just Free the
 component. Then OnSessionClose will not fire. What will fire is
 OnChangeState, so be aware if you do things there like updating GUI or
 so.

 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz

 Saturday, March 4, 2006, 09:33, Jack wrote:

 My application halts when WSocketServer is freed, not every time
 though. But it happens once in a few times when the application is
 closed. Here's the code snippet:

   if WSocketServer  nil then
   begin
 WSocketServer.Abort();
 Log('Server closed');
 FreeAndNil(WSocketServer);
 Log('Server freed');
   end;

 When this happens, the last message I get is 'Server closed' so
 it dies in FreeAndNil(WSocketServer); Log() just add a line in
 a TMemo. They were added after this problem was seen.

 I enabled Check for frozen main thread in madexcept and got
 this report:

 main thread ($728):
 7c90eb94 + ntdll.dll  KiFastSystemCallRet
 77d5f3de +0044 user32.dll SendMessageA
 71ab8cc3 +489b WS2_32.dll WSACleanup
 0048cdc4 +0018 Test.exe WSocket  1789  +2 
 WSocket_Synchronized_WSACleanup
 0048d5d9 +0035 Test.exe WSocket  2221 +12 WSocketUnloadWinsock
 0048e2d7 +007f Test.exe WSocket  3507 +16 TCustomWSocket.Destroy
 00493877 +0037 Test.exe WSocket  6378  +6 TCustomLineWSocket.Destroy
 00494c0e +0092 Test.exe WSocketS  278 +15 
 TCustomWSocketServer.Destroy
 00402e60 +0008 Test.exe SystemTObject.Free
 00454be4 +0008 Test.exe SysUtils  FreeAndNil
 0049e2ad +0031 Test.exe fTest 213  +5 TFrmTest.CleanUp
 0049e148 +004c Test.exe fTest 133 +15 TFrmTest.FormClose


 disassembling:
 [...]
 0048cdac 1787   cmp dword ptr [$4a5a14], 0
 0048cdb3jnz loc_48cdc4
 0048cdb5 1788   mov eax, $48cdd4   ; 'WSACleanup'
 0048cdbacall+$979 ($48d738); WSocket.WSocketGetProc
 0048cdbfmov [$4a5a14], eax
 0048cdc4 1789 = calldword ptr [$4a5a14];
 0048cdc4 1789   WSACleanup (WS2_32.dll)
 0048cdca 1790   ret


 Anything I'm doing wrong?


-- 
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] TWSocketServer halts when freed

2006-03-04 Thread Jack
Hello Wilfried,

It looks like it. But it could be SendMessageA called by
WSACleanup, which waits until SendMessageA message is processed.
Maybe this is because the target window and winproc has
been destroyed by TCustomWSocket.Destroy?

-- 
Best regards,
Jack

Saturday, March 4, 2006, 10:24:04 AM, you wrote:

 Hello Jack,

 I'm checking the log again in your first mail:

 main thread ($728):
 7c90eb94 + ntdll.dll  KiFastSystemCallRet
 77d5f3de +0044 user32.dll SendMessageA
 71ab8cc3 +489b WS2_32.dll WSACleanup
 0048cdc4 +0018 Test.exe WSocket  1789  +2 
 WSocket_Synchronized_WSACleanup
 0048d5d9 +0035 Test.exe WSocket  2221 +12 WSocketUnloadWinsock
 0048e2d7 +007f Test.exe WSocket  3507 +16 TCustomWSocket.Destroy
 00493877 +0037 Test.exe WSocket  6378  +6 TCustomLineWSocket.Destroy
 00494c0e +0092 Test.exe WSocketS  278 +15 TCustomWSocketServer.Destroy
 00402e60 +0008 Test.exe SystemTObject.Free
 00454be4 +0008 Test.exe SysUtils  FreeAndNil
 0049e2ad +0031 Test.exe fTest 213  +5 TFrmTest.CleanUp
 0049e148 +004c Test.exe fTest 133 +15 TFrmTest.FormClose

 It seems that all is destroyed and that there is something 'hanging' in
 ntdll.dll. Is this right conclusion because I dont know the MadExcept ?

 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz

 Saturday, March 4, 2006, 18:31, Jack wrote:

 Hello Wilfried,

 Thanks for the quick reply. No, I don't have a OnSessionClose or
 OnChangeState handler. Destroying the server object will abort the
 socket? Anyway, I also removed Abort() but the problem is still
 happening from time to time as before.

 -- 
 Best regards,
 Jack

 Saturday, March 4, 2006, 1:21:05 AM, you wrote:

 Hello Jack,

 I read your mail better now :) No need for Abort. Just Free the
 component. Then OnSessionClose will not fire. What will fire is
 OnChangeState, so be aware if you do things there like updating GUI or
 so.

 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz

 Saturday, March 4, 2006, 09:33, Jack wrote:

 My application halts when WSocketServer is freed, not every time
 though. But it happens once in a few times when the application is
 closed. Here's the code snippet:

   if WSocketServer  nil then
   begin
 WSocketServer.Abort();
 Log('Server closed');
 FreeAndNil(WSocketServer);
 Log('Server freed');
   end;

 When this happens, the last message I get is 'Server closed' so
 it dies in FreeAndNil(WSocketServer); Log() just add a line in
 a TMemo. They were added after this problem was seen.

 I enabled Check for frozen main thread in madexcept and got
 this report:

 main thread ($728):
 7c90eb94 + ntdll.dll  KiFastSystemCallRet
 77d5f3de +0044 user32.dll SendMessageA
 71ab8cc3 +489b WS2_32.dll WSACleanup
 0048cdc4 +0018 Test.exe WSocket  1789  +2
 WSocket_Synchronized_WSACleanup
 0048d5d9 +0035 Test.exe WSocket  2221 +12 WSocketUnloadWinsock
 0048e2d7 +007f Test.exe WSocket  3507 +16 TCustomWSocket.Destroy
 00493877 +0037 Test.exe WSocket  6378  +6 
 TCustomLineWSocket.Destroy
 00494c0e +0092 Test.exe WSocketS  278 +15 
 TCustomWSocketServer.Destroy
 00402e60 +0008 Test.exe SystemTObject.Free
 00454be4 +0008 Test.exe SysUtils  FreeAndNil
 0049e2ad +0031 Test.exe fTest 213  +5 TFrmTest.CleanUp
 0049e148 +004c Test.exe fTest 133 +15 TFrmTest.FormClose


 disassembling:
 [...]
 0048cdac 1787   cmp dword ptr [$4a5a14], 0
 0048cdb3jnz loc_48cdc4
 0048cdb5 1788   mov eax, $48cdd4   ; 'WSACleanup'
 0048cdbacall+$979 ($48d738); WSocket.WSocketGetProc
 0048cdbfmov [$4a5a14], eax
 0048cdc4 1789 = calldword ptr [$4a5a14];
 0048cdc4 1789   WSACleanup (WS2_32.dll)
 0048cdca 1790   ret


 Anything I'm doing wrong?




-- 
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] TWSocketServer halts when freed

2006-03-04 Thread Jack
Hello Wilfried,

It's a little difficult to make a simple project out of it
because the project is kind of complicated already. Maybe I'll
do that when I'm not so busy.

I wonder if you can think of anything that I can hack around
just to see if it'll fix the problem?

-- 
Best regards,
Jack

Saturday, March 4, 2006, 11:52:02 AM, you wrote:

 Hello Jack,

 But it could be SendMessageA called by

 Yes possible.

 Jack can you try to make a simple new project to demonstrate the
 behaviour ? I will be glad to try debug in it.

 Wich delphi version do you use ?

 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz

 Saturday, March 4, 2006, 19:54, Jack wrote:

 Hello Wilfried,

 It looks like it. But it could be SendMessageA called by
 WSACleanup, which waits until SendMessageA message is processed.
 Maybe this is because the target window and winproc has
 been destroyed by TCustomWSocket.Destroy?

 -- 
 Best regards,
 Jack

 Saturday, March 4, 2006, 10:24:04 AM, you wrote:

 Hello Jack,

 I'm checking the log again in your first mail:

 main thread ($728):
 7c90eb94 + ntdll.dll  KiFastSystemCallRet
 77d5f3de +0044 user32.dll SendMessageA
 71ab8cc3 +489b WS2_32.dll WSACleanup
 0048cdc4 +0018 Test.exe WSocket  1789  +2
 WSocket_Synchronized_WSACleanup
 0048d5d9 +0035 Test.exe WSocket  2221 +12 WSocketUnloadWinsock
 0048e2d7 +007f Test.exe WSocket  3507 +16 TCustomWSocket.Destroy
 00493877 +0037 Test.exe WSocket  6378  +6 TCustomLineWSocket.Destroy
 00494c0e +0092 Test.exe WSocketS  278 +15 
 TCustomWSocketServer.Destroy
 00402e60 +0008 Test.exe SystemTObject.Free
 00454be4 +0008 Test.exe SysUtils  FreeAndNil
 0049e2ad +0031 Test.exe fTest 213  +5 TFrmTest.CleanUp
 0049e148 +004c Test.exe fTest 133 +15 TFrmTest.FormClose

 It seems that all is destroyed and that there is something 'hanging' in
 ntdll.dll. Is this right conclusion because I dont know the MadExcept ?

 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz

 Saturday, March 4, 2006, 18:31, Jack wrote:

 Hello Wilfried,

 Thanks for the quick reply. No, I don't have a OnSessionClose or
 OnChangeState handler. Destroying the server object will abort the
 socket? Anyway, I also removed Abort() but the problem is still
 happening from time to time as before.

 -- 
 Best regards,
 Jack

 Saturday, March 4, 2006, 1:21:05 AM, you wrote:

 Hello Jack,

 I read your mail better now :) No need for Abort. Just Free the
 component. Then OnSessionClose will not fire. What will fire is
 OnChangeState, so be aware if you do things there like updating GUI or
 so.

 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz

 Saturday, March 4, 2006, 09:33, Jack wrote:

 My application halts when WSocketServer is freed, not every time
 though. But it happens once in a few times when the application is
 closed. Here's the code snippet:

   if WSocketServer  nil then
   begin
 WSocketServer.Abort();
 Log('Server closed');
 FreeAndNil(WSocketServer);
 Log('Server freed');
   end;

 When this happens, the last message I get is 'Server closed' so
 it dies in FreeAndNil(WSocketServer); Log() just add a line in
 a TMemo. They were added after this problem was seen.

 I enabled Check for frozen main thread in madexcept and got
 this report:

 main thread ($728):
 7c90eb94 + ntdll.dll  KiFastSystemCallRet
 77d5f3de +0044 user32.dll SendMessageA
 71ab8cc3 +489b WS2_32.dll WSACleanup
 0048cdc4 +0018 Test.exe WSocket  1789  +2
 WSocket_Synchronized_WSACleanup
 0048d5d9 +0035 Test.exe WSocket  2221 +12 WSocketUnloadWinsock
 0048e2d7 +007f Test.exe WSocket  3507 +16 TCustomWSocket.Destroy
 00493877 +0037 Test.exe WSocket  6378  +6 
 TCustomLineWSocket.Destroy
 00494c0e +0092 Test.exe WSocketS  278 +15
 TCustomWSocketServer.Destroy
 00402e60 +0008 Test.exe SystemTObject.Free
 00454be4 +0008 Test.exe SysUtils  FreeAndNil
 0049e2ad +0031 Test.exe fTest 213  +5 TFrmTest.CleanUp
 0049e148 +004c Test.exe fTest 133 +15 TFrmTest.FormClose


 disassembling:
 [...]
 0048cdac 1787   cmp dword ptr [$4a5a14], 0
 0048cdb3jnz loc_48cdc4
 0048cdb5 1788   mov eax, $48cdd4   ; 'WSACleanup'
 0048cdbacall+$979 ($48d738); WSocket.WSocketGetProc
 0048cdbfmov [$4a5a14], eax
 0048cdc4 1789 = calldword ptr [$4a5a14];
 0048cdc4 1789   WSACleanup (WS2_32.dll)
 0048cdca 1790   ret


 Anything I'm doing wrong?






-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman

Re: [twsocket] OnDataAvailable called before shutdown with no data

2006-02-18 Thread Jack
Hello Francois,

I find that calling pause in OnSessionConnected() is effective.
But calling pause in OnClientDataAvailable() does not work.
OnClientDataAvailable() keeps getting fired. Any ideas?

-- 
Best regards,
Jack

Sunday, January 22, 2006, 10:33:21 AM, you wrote:

 Maybe use Pause/Resume ?

 Oh, I didn't even know these two methods. So Pause will stop
 all network connectivity on that socket until it's resumed?

 It suppress async notification. So you don't receive events anymore but I/O
 continue as much as winsock can, for example filling his receive buffer.



-- 
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] OnDataAvailable called before shutdown with no data

2006-01-23 Thread Jack
Hello Francois,

 You can't ignore OnDataavailable event !

Got it.

  There is a flag FPaused but it is not exposed as a property.

 Oh, will you be able to expose it? I can modify the source
 code for now but I think it's useful when Pause and Resume
 is exposed.

 Not really. You can have a flag set/reset in your own application
 when you call Pause/Resume, or you
 can derive from TWSocket and create the property in your derived
 component. That's what OOP is all about.

Hmm. Is there any particular reason that you don't want to expose
FPaused?

It seems safe to call Resume on all client socket without checking,
am I right?

Thanks,
Jack


-- 
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] OnDataAvailable called before shutdown with no data

2006-01-22 Thread Jack
Hello Francois,

Is there a way to tell the number of bytes available without
actually retrieving the data? At some point I'd like to know
if there is data available but do not want to actually remove
the data from twsocket's buffer. This is because I want to
open a remote socket and make sure it's in wsConnected state,
then I'll retrieve data and send it through the remote socket.
The idea is to skip OnDataAvailable if no data is available,
and when there is some data, connect to a remote server, skip
more OnDataAvailable until the remote socket is connected, then
actually retrieve data and send the data via remote socket.

Or is it a bad idea to do so?

An alternative way is to call Receive() and allocate memory
and cache the data into memory before remote socket is available.
But is this necessary?

-- 
Best regards,
Jack

Sunday, January 22, 2006, 4:24:57 AM, you wrote:

 Instead of ReceiveStr, call Receive to be able to get winsock.recv return
 code. This return code is -1 if some error occure, 0 is remote has 
 gracefully closed or a positive integer to telle how many bytes you have
 received.

 Usually you can safely ignore any OnDataAvailable where Receive return = 0.

 --
 Contribute to the SSL Effort. Visit
 http://www.overbyte.be/eng/ssl.html
 --
 [EMAIL PROTECTED]
 http://www.overbyte.be



 - Original Message - 
 From: Jack [EMAIL PROTECTED]
 To: twsocket@elists.org
 Sent: Sunday, January 22, 2006 5:25 AM
 Subject: [twsocket] OnDataAvailable called before shutdown with no data


 Hello Francois and all,

 I use telnet as client to connect to a twsocketserver,
 after connecting to it, without sending any data from
 the client (do not type anything in telnet) I call shutdown(1)
 on all the client sockets. After this, although there is no
 data received, the client socket's OnDataAvailable is called.
 But if I call ReceiveStr(), I got data length 0.

 Is this a bug - because there's actually no data received?

 If it's not a bug, is there a way to tell if there is any
 data before calling ReceiveStr() or Receive()?

 -- 
 Best regards,
 Jack

 -- 
 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] OnDataAvailable called before shutdown with no data

2006-01-22 Thread Jack
Hello Francois,

 Maybe use Pause/Resume ?

 It suppress async notification. So you don't receive events anymore but I/O
 continue as much as winsock can, for example filling his receive buffer.

Got it. Wouldn't this be similar to ignoring OnDataAvailable event
and is vulnerable to DOS attack?

 If so, I guess I Pause the client socket and resume it when
 the resume socket is connected.

 Not sure I understand, but probably the answer is yes :-)

Sorry for the typo. I meant remote, not resume ;) and you
guess is right :)

 Is there a flat to check if a client socket is paused?

 There is a flag FPaused but it is not exposed as a property.

Oh, will you be able to expose it? I can modify the source
code for now but I think it's useful when Pause and Resume
is exposed.

And sorry for the typo again. I meant flag, not flat. You
got that right, too :)

Jack

-- 
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


[twsocket] OnDataAvailable called before shutdown with no data

2006-01-21 Thread Jack
Hello Francois and all,

I use telnet as client to connect to a twsocketserver,
after connecting to it, without sending any data from
the client (do not type anything in telnet) I call shutdown(1)
on all the client sockets. After this, although there is no
data received, the client socket's OnDataAvailable is called.
But if I call ReceiveStr(), I got data length 0.

Is this a bug - because there's actually no data received?

If it's not a bug, is there a way to tell if there is any
data before calling ReceiveStr() or Receive()?

-- 
Best regards,
Jack

-- 
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] Process pooling for CGI

2006-01-12 Thread Jack
Guess this is OT, but check out FastCGI interface.

 Hello,

 Is this possible? I want to keep the PHP-cgi.exe process loaded in memory
 for fast execution. Or is this what ISAPI can only do?

 Regards,

 SubZero 


-- 
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] ICS-V6 supported compilers

2005-12-28 Thread Jack
Hello Francois,

I use Delphi 5 and Delphi 2005, neither is on your supported list :(

Will V6 be completely replacing V5, or will it be a branch like SSL?

-- 
Best regards,
Jack

Wednesday, December 28, 2005, 9:22:59 AM, you wrote:

 I plan to support Delphi 7, Delphi 2006 (Win32 and .NET) and C-Builder 2006
 only.
 Any tought ?

 --
 Contribute to the SSL Effort. Visit
 http://www.overbyte.be/eng/ssl.html
 --
 [EMAIL PROTECTED]
 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] ICS-V6 supported compilers

2005-12-28 Thread Jack
Hello Francois,

 Delphi 5 is really too old.

I know. But it's just as good, or better (smaller executable
size and smaller memory footprint) than Delphi 7. I really
like Delphi 5. And ICS works equally well on D5 as on any other
versions of Delphi. It's a pity to drop it.

 Delphi 2005 is too slow and too buggy compared to Delphi 2006 which seems so
 far to be as good as Delphi 7 but has much more features.

Delphi 2005 is slow. It got much better after the 3 updates.
I'm not sure if 2006 justifies the upgrade cost, though.

 V6 will completely replace V5. Last V5 version will be released very shortly
 now. I'm waiting some bugs fixes comming from ICS-SSL.

 Today, V5 and V6 are really close (use WinMerge to compare the source code.
 Configure it to ignore char case and white spaces).

 Once V6 beta is accepted, I will remove old code conditionnally compiled and
 start adding new features using compiler features not available in older
 compilers.

Sounds fair for new features to go to new versions.
Will bug fixes be going into V5? Everyone on the list must have
a bunch of legacy projects running.

 I even consider dropping Delphi 7 support for V7. I have to see how the
 market will accept Delphi 2006.

Most components tend to lag behind Delphi version upgrades.
ICS is fast in catching up (and is getting faster in dumping
earlier Delphi versions :)



-- 
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] Can ICS raw socket be used to sniff traffic?

2005-12-02 Thread Jack
Hello Angus,

I tried your component on two Windoes XP SP1 PCs. Both are
IBM ThinkPad laptops, two different models though. On one of them
it works, capturing only inbound traffic. This is ok. On the other
one, I got the error below (using raw socket, not pcap) and right
after that I got a blue screen with memory dump. After rebooting,
I tried the second time. I got the same error but the PC didn't
reboot. Any ideas why I'm getting the error and why it crashed?
The error shown in the log window:

Failed to Start Monitor - Error 10022 in function WSAIoctl(SIO_RCVALL)
Invalid argument

-- 
Best regards,
Jack

Friday, November 11, 2005, 12:19:00 PM, you wrote:

 I remember seeing an example using WinXP raw socket to
 sniff network traffic. Raw socket support has been added
 to ICS (but I have no experience with it yet.) I wonder if
 ICS raw socket can be used to sniff traffic sent to local
 PC?

 My Internet Packet Monitoring Components can be downloaded from 
 http://www.magsys.co.uk/delphi/, and will monitor using either raw 
 sockets or winpcap.  

 Basically, I'd like to know the IP and MAC address of the default
 gateway. If not raw socket, any other ways to know that?
 I can probably use winpcap to sniff the traffic but I would
 not use it if I don't have to.

 You can use my Internet Protocol Helper Component, same URL (or the 
 Usermade ICS page), to read the PC IP routing table which will give you
 the IP of the next hops for various destination addresses, since there
 may be multiple gateways.  The ARP table gives you the MAC for the IPs
 you found.  There's a demo program that lists all this stuff. 

 Angus

-- 
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


[twsocket] Can ICS raw socket be used to sniff traffic?

2005-11-11 Thread Jack
Hello,

I remember seeing an example using WinXP raw socket to
sniff network traffic. Raw socket support has been added
to ICS (but I have no experience with it yet.) I wonder if
ICS raw socket can be used to sniff traffic sent to local
PC?

Basically, I'd like to know the IP and MAC address of the default
gateway. If not raw socket, any other ways to know that?
I can probably use winpcap to sniff the traffic but I would
not use it if I don't have to.

-- 
Best regards,
Jack

-- 
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] Downloading a webpage, including its pictures. How??

2005-10-29 Thread Jack
It actually takes more than one THttpCli.Get().
My understanding is that once you get the initial html, you have
to parse it, get all the links, and request them, until you exhaust
the links.

Jack

 Do you have any examples of how to use THttpCli for tasks like this?

 /Perry

 Arno Garrels wrote:

Public wrote:
  

Hello,

I would like to download a webpage, including all its pictures, to my
local harddrive.
I will later use the local file and display this in a Twebbrowser.

How can I do this?
Which components do you recommend me to use?



THttpCli is your friend. The rest is elaboration. 

---
Arno Garrels [ICSTeam]

 


  


-- 
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


[twsocket] Does THttpCli timeout?

2005-10-26 Thread Jack
Hello,

Real quick question.

It is my understanding that THttpCli does not timeout.
Say, it has connected to the web server and sent the request.
But if the server doesn't send anything back, THttpCli will
not timeout. Am I correct?

-- 
Best regards,
Jack

-- 
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] Does THttpCli timeout?

2005-10-26 Thread Jack
Thank you Wilfried and Arno for the real quick replies :)

 Winsock will timeout after a while, but this is depending on many
 factors and can take a long time. For automated aplications use your own
 timeout.

Any idea how long it can be? Like, a few minutes? or hours?

 Real quick question.

 It is my understanding that THttpCli does not timeout.
 Say, it has connected to the web server and sent the request.
 But if the server doesn't send anything back, THttpCli will
 not timeout. Am I correct?

 -- 
 Best regards,
 Jack



-- 
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] Does THttpCli timeout?

2005-10-26 Thread Jack
Hello Wilfried,

I wonder why would winsock even time out in this case?
Isn't it legitimate to have a socket connected and doing nothing?

-- 
Best regards,
Jack

Wednesday, October 26, 2005, 1:35:36 PM, you wrote:

 Hello Jack,

 real quick answer :)
  correct !

 Winsock will timeout after a while, but this is depending on many
 factors and can take a long time. For automated aplications use your own
 timeout.

 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz

 Wednesday, October 26, 2005, 19:24, Jack wrote:

 Hello,

 Real quick question.

 It is my understanding that THttpCli does not timeout.
 Say, it has connected to the web server and sent the request.
 But if the server doesn't send anything back, THttpCli will
 not timeout. Am I correct?

 -- 
 Best regards,
 Jack



-- 
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] Async http, close or closeAsync?

2005-10-20 Thread Jack
Hello Francois,

I called CloseAsync() in OnRequestDone. However, CloseAsync()
seems to be triggering another OnRequestDone and causing a
endless loop ... I tried both cases of the remote IP being available
and unavailable (OnRequestDone returns an error in this case.)

Is it necessary to call CloseAsync() in OnRequestDone?
What exactly is CloseAsync() for?

-- 
Best regards,
Jack

Thursday, October 20, 2005, 2:39:26 AM, you wrote:

 I'm using httpcli in async mode. 
 Should I use httpcli.Close() or httpcli.CloseAsync()?

 CloseAsync

 --
 Contribute to the SSL Effort. Visit
 http://www.overbyte.be/eng/ssl.html
 --
 [EMAIL PROTECTED]
 Author of ICS (Internet Component Suite, freeware)
 Author of MidWare (Multi-tier framework, freeware)
 http://www.overbyte.be


 - Original Message - 
 From: Jack [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Thursday, October 20, 2005 12:22 AM
 Subject: [twsocket] Async http, close or closeAsync?


 Hello all,
 
 I'm using httpcli in async mode. Since I'm using http 1.0,
 most likely the server will disconnect when it's done sending
 the data. I just want to be sure so I plan to disconnect in
 HttpCliRequestDone event handler. Should I use httpcli.Close() or
 httpcli.CloseAsync()?
 
 Thanks.
 -- 
 Best regards,
 Jack
 
 -- 
 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


[twsocket] Async http, close or closeAsync?

2005-10-19 Thread Jack
Hello all,

I'm using httpcli in async mode. Since I'm using http 1.0,
most likely the server will disconnect when it's done sending
the data. I just want to be sure so I plan to disconnect in
HttpCliRequestDone event handler. Should I use httpcli.Close() or
httpcli.CloseAsync()?

Thanks.
-- 
Best regards,
Jack

-- 
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] Does ICS support ...

2005-10-18 Thread Jack
Hello Wilfried and Francois,

Thanks for the replies.

According to Francois's reply, even if ICS works for FP Windows,
it most likely will not work for FP Mac or FP Linux. I think I'm
better off doing it in C/C++. (If anyone has experience with ICS
working on Kylix/FP, Mac/Linux, I'll be glad to hear about it :)

-- 
Best regards,
Jack

Tuesday, October 18, 2005, 3:10:23 AM, you wrote:

 Hello Jack,

 I was just editing this faq whitch could answer one of your questions:

 [Author]
 Marco van de Voort
 [Email]
 [EMAIL PROTECTED]

 [Answer] Since there seem to be quite some confusion about the extend of
 fixes FPC needs, I made a ICS/FPC status page, that explains the needed
 changes, reasons and versions:

   http://www.stack.nl/~marcov/ics.html

 Since the fpc port is only available on CVS, I quickly zipped it, and
 put it at

   http://www.stack.nl/~marcov/icsfpc.zip

 ---
 Rgds, Wilfried [TeamICS]
 http://www.mestdagh.biz

 Tuesday, October 18, 2005, 00:17, Jack wrote:

 Hello all,

 I have a few questions about what ICS supports and doesn't support:

 - Does ICS support Linux (Kylix)?
   There are a few versions of ICS for various versions of Kylix.
   I'm not sure how well ICS works on Linux. I remember seeing
   some discussions regarding the different mechanism of signaling
   and messaging between Windows and Linux. I'm not sure if that
   means that there are still issues?

 - Does ICS support FreePascal?
   I saw some sporadic mentioning of FreePascal in ICS archive
   but I didn't get an impression that FreePascal is supported.

 The reason I'm asking is that I have a Delphi application that
 I have to partially port (or rewrite in C/C++) to Linux and MacOS
 (MacOS X and earlier versions of MacOS) Delphi definitely doesn't
 do that. I looked at FreePascal and Lasarus. They both claim
 to support all of Windows/Linux/MacOS-es. Because the functionality
 involves socket, I'm hoping that I can use ICS...

 -- 
 Best regards,
 Jack



-- 
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


[twsocket] Does ICS support ...

2005-10-17 Thread Jack
Hello all,

I have a few questions about what ICS supports and doesn't support:

- Does ICS support Linux (Kylix)?
  There are a few versions of ICS for various versions of Kylix.
  I'm not sure how well ICS works on Linux. I remember seeing
  some discussions regarding the different mechanism of signaling
  and messaging between Windows and Linux. I'm not sure if that
  means that there are still issues?

- Does ICS support FreePascal?
  I saw some sporadic mentioning of FreePascal in ICS archive
  but I didn't get an impression that FreePascal is supported.

The reason I'm asking is that I have a Delphi application that
I have to partially port (or rewrite in C/C++) to Linux and MacOS
(MacOS X and earlier versions of MacOS) Delphi definitely doesn't
do that. I looked at FreePascal and Lasarus. They both claim
to support all of Windows/Linux/MacOS-es. Because the functionality
involves socket, I'm hoping that I can use ICS...

-- 
Best regards,
Jack

-- 
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] finding a local domain

2005-10-15 Thread Jack
I used sheerdns before. Very easy to set up. Works with cygwin dll.

 Wilfried Mestdagh wrote:
 Hello Arno,
 
 Forget it, it is shareware.
 
Could not find a freeware one also.
I really thought this would be a sooo simple to solve problem :(

 Probably overkill for your customers?
 http://posadis.sourceforge.net/posadis/

-- 
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] BgException when a tcp client application is started byanother application

2005-09-28 Thread Jack
Hello Francois,

I'll try that.

Any idea why it doesn't happen when it's run from Windows Explorer?

-- 
Best regards,
Jack

Wednesday, September 28, 2005, 2:36:34 PM, you wrote:

 BgException: EConvertError: Invalid argument to date encode

 You pass an invalid argument to some date encode function. This happend in
 one of your socket event hanlder since it is trapped by BgException.

 I suggest you use MadExcept to find where it occurs exactly.
 MadExcept is really an incredibly good product (Free for non commercial
 use). See http://www.madshi.net/olddlp3.htm.

 --
 Contribute to the SSL Effort. Visit
 http://www.overbyte.be/eng/ssl.html
 --
 [EMAIL PROTECTED]
 http://www.overbyte.be



 - Original Message - 
 From: Jack [EMAIL PROTECTED]
 To: twsocket@elists.org
 Sent: Wednesday, September 28, 2005 8:20 PM
 Subject: [twsocket] BgException when a tcp client application is started
 byanother application


 Hello Francois and all,

 I have a TCP client application that runs just fine by itself,
 meaning, starts directly from Windows Explorer, or Start Menu.
 However, when the application is started by another application,
 I always get this errpr:

 BgException: EConvertError: Invalid argument to date encode

 Then the session is closed with  ErrCode 0.

 No matter how it's started (ShellExecute, or CreateProcess, etc.)
 it always happens. I also tried starting from a .NET application
 and a Delphi application, same error. Any ideas?

 -- 
 Best regards,
 Jack

 -- 
 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] BgException when a tcp client application is started byanother application

2005-09-28 Thread Jack
Hello Francois,

I installed madExcept, and verified it working with a divided by 0
exception I created on purpose. It was caught by madExcept. However, the 
problem I
had in BgException didn't raise any exception that madExcept was
able to catch...

-- 
Best regards,
Jack

Wednesday, September 28, 2005, 2:36:34 PM, you wrote:

 BgException: EConvertError: Invalid argument to date encode

 You pass an invalid argument to some date encode function. This happend in
 one of your socket event hanlder since it is trapped by BgException.

 I suggest you use MadExcept to find where it occurs exactly.
 MadExcept is really an incredibly good product (Free for non commercial
 use). See http://www.madshi.net/olddlp3.htm.

 --
 Contribute to the SSL Effort. Visit
 http://www.overbyte.be/eng/ssl.html
 --
 [EMAIL PROTECTED]
 http://www.overbyte.be



 - Original Message - 
 From: Jack [EMAIL PROTECTED]
 To: twsocket@elists.org
 Sent: Wednesday, September 28, 2005 8:20 PM
 Subject: [twsocket] BgException when a tcp client application is started
 byanother application


 Hello Francois and all,

 I have a TCP client application that runs just fine by itself,
 meaning, starts directly from Windows Explorer, or Start Menu.
 However, when the application is started by another application,
 I always get this errpr:

 BgException: EConvertError: Invalid argument to date encode

 Then the session is closed with  ErrCode 0.

 No matter how it's started (ShellExecute, or CreateProcess, etc.)
 it always happens. I also tried starting from a .NET application
 and a Delphi application, same error. Any ideas?

 -- 
 Best regards,
 Jack

 -- 
 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] BgException when a tcp client application is started byanother application

2005-09-28 Thread Jack
Hello Francois,

I found the problem by examining all the socket event handlers.
You are right. It's a date time conversion function that gets
an invalid environment parameter when run from another app.

I think the reason madExcept didn't catch it is because BgExcept
caught it?

Anyway, thanks a lot!

-- 
Best regards,
Jack

Wednesday, September 28, 2005, 2:36:34 PM, you wrote:

 BgException: EConvertError: Invalid argument to date encode

 You pass an invalid argument to some date encode function. This happend in
 one of your socket event hanlder since it is trapped by BgException.

 I suggest you use MadExcept to find where it occurs exactly.
 MadExcept is really an incredibly good product (Free for non commercial
 use). See http://www.madshi.net/olddlp3.htm.

 --
 Contribute to the SSL Effort. Visit
 http://www.overbyte.be/eng/ssl.html
 --
 [EMAIL PROTECTED]
 http://www.overbyte.be



 - Original Message - 
 From: Jack [EMAIL PROTECTED]
 To: twsocket@elists.org
 Sent: Wednesday, September 28, 2005 8:20 PM
 Subject: [twsocket] BgException when a tcp client application is started
 byanother application


 Hello Francois and all,

 I have a TCP client application that runs just fine by itself,
 meaning, starts directly from Windows Explorer, or Start Menu.
 However, when the application is started by another application,
 I always get this errpr:

 BgException: EConvertError: Invalid argument to date encode

 Then the session is closed with  ErrCode 0.

 No matter how it's started (ShellExecute, or CreateProcess, etc.)
 it always happens. I also tried starting from a .NET application
 and a Delphi application, same error. Any ideas?

 -- 
 Best regards,
 Jack

 -- 
 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


[twsocket] A simple question: how to add custom http headers with httpcli?

2005-06-08 Thread Jack
A simple question: how to add custom http headers with httpcli?
I looked at the properties but did not find a string list property
that seemingly fit this purpose...

-- 
Best regards,
Jack


-- 
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


[twsocket] Http proxy tunneling?

2005-06-07 Thread Jack
I saw http proxy tunneling (connect through http proxy
servers that support CONNECT method) mentioned a few times on
the list but has anyone actually implemented it?
It's similar to the socks proxy support. I looked at
wsocket code. A lot of it has to do with socks proxy support.
Http proxy tunneling would probably take the same amount of effort,
which is a little intimidating to me (time availability and the
possibility of messing up the well tested code) So I'm asking to
see if someone has actually implemented it, but did not put in
Francois's distribution.

-- 
Best regards,
Jack


-- 
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[2]: [twsocket] Receive result of the first ReceiveStr() call twice-not resolved

2005-06-02 Thread Jack
Hello Francois,

Thanks for the quick reply. You are right. I should check in
the code. But in this particular test environment, I am receiving
HTTP/1.x. This I checked from the log.

I looked at the httpcli code briefly yesterday but failed to
find the part that parses the http headers (I know it should be there.)

I have been displaying the logs in a TMemo and yes, I do receive
a part of the string twice as shown in the log. I didn't call any
of the functions you mentioned in your earlier emails about what
could mess up the message pump.

I have further stripped the test project - very simple now.
I will email it to you. Please take a look when you have time.

BTW, are attachments allowed here, or should I send you a private mail?

-- 
Best regards,
Jack

Thursday, June 2, 2005, 6:43:30 AM, you wrote:

 To avoid difficulties, you should first correctly write your
 GetHTTPReponseStatusCode function to
 correctly parse the answer. You should not simply remove
 HTTP/1.1 but actually check you really
 have that string. I'm sure you think you receive data twice while
 you aren't. You think you receive
 it twice because you don't parse it correctly and you overlooked
 the mechanism that makes TCP stream
 split into several packets and OnDataAvailable events.

 You can have look at the HTTP client component source code (if
 you don't want to use it, look at the
 code and copy what you need to reinvent your wheel).

 Use OutputDebugString to display what you receive in your
 OnDataAvailable event. You'll see that you
 never receive data twice, unless you mess up with the message pump.

 --
 [EMAIL PROTECTED]
 Auteur du freeware ICS - Internet Component Suite
 Auteur du freeware MidWare - Multi-tiers framework
 http://www.overbyte.be



 - Original Message - 
 From: Jack [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Thursday, June 02, 2005 12:39 AM
 Subject: Re: [twsocket] Receive result of the first ReceiveStr() call 
 twice-not resolved


 This problem is still bugging me. I did some further testing
 and find some strange things. In the OnDataAvailable event
 handler, I call the function below to get HTTP status code.
 The HttpReply is the string variable I get from ReceiveStr() call.
 I find that as long as I call this function, I get a part of
 the HTTP reply twice from ReceiveStr() call. Further testing
 shows that this line is teh culprit:

   Result := StrToInt(s);

 If I comment out this line, I don't have a problem (then I don't
 get a result from the function either.)

 Any ideas? (Below is the whole function.)

 function GetHTTPReponseStatusCode(const HttpReply: String): Integer;
 var i: Integer; s: String;
 begin
   Result := -1;
   i := Pos(' ', HttpReply);
   if i  0 then
   begin
 s := Copy(HttpReply, i + 1, Length(HttpReply)); // Remove HTTP/1.1  at 
 the beginning
 i := Pos(' ', s); // Remove the trailing text
 if i  0 then
 begin
   s := Copy(s, 1, i - 1);
   Result := StrToInt(s);
 end;
   end;
 end;

 -- 
 Best regards,
 Jack

  I celebrated a little too early. I am getting this problem again
  in further testing after I changed Close() to CloseDelayed();
  The difference is, I'm not getting result of the first ReceiveStr()
  twice. Instead, I get the result of the second ReceiveStr() twice.
  I think this is because CloseDelayed() delayed the Close().
  What I don't understand is why the buffer isn't cleared after
  ReceiveStr() in both scenarios of Close() and CloseDelayed().
 
  I reason I thought it was fixed is because I tested from
  an allowed IP earlier and got a very short response back from
  the proxy server. The whole message was retrieved in the first
  ReceiveStr() call so I didn't get a chance to call ReceiveStr()
  twice. I then run the same app on a blocked IP. The proxy sends
  a longer message (the error message) and it is retrieved in
  two ReceiveStr() calls. Then I found that the second ReceiveStr()
  result was duplicated.
 
  -- 
  Best regards,
  Jack
 
  Thursday, May 19, 2005, 10:53:49 AM, you wrote:
 
  J Francois, thanks! This fixed the problem! It's actually in the FAQ:
 
  J - CloseDelayed
 
  J Is in most cases the preferred way. It will post a message to
  J itself to close the TWSocket. This means that the socket closure
  J is done outside the code that calls the CloseDelayed, meaning a
  J while later. The message handler will call Close.
 
  J - Close
 
  J Attempt to gracefully close the socket. If there is still some
  J data waiting in the buffers it will try to send it. ***Do not use
  J Close from within any TWSocket events, instead use CloseDelayed.***
 
 
  J Thursday, May 19, 2005, 2:46:47 AM, you wrote:
 
  FP Use CloseDelayed instead of Close.
 
   Hello Wilfried,
  
   Sure. Below is my event handler code. Hope I'm doing something
   wrong, otherwise, it's really strange. TProxyChecker is the owner
   object of the TProxySocket object array. TProxySocket is derived
   from TWSocket

Re[4]: [twsocket] Receive result of the first ReceiveStr() calltwice-not resolved

2005-06-02 Thread Jack
Hello Francois,

I've uploaded the project here:
http://chatsvr.no-ip.org/download/ProxyTester.zip

It was created with Delphi 2005. I could build it with D5
after deleting the Variant unit from uses clause.

If you build it as is, you'll see this (long) line twice:

6/2/2005 10:39:36 AM htmlbodyfont size=5 color=#FFbrbAccess 
denied due to Proxy+'s Security settings!/b/fonthr
bDescription:/b REJECTED - by default (no rule allowed the access)
brbRequest details:/b HTTPS; 65.110.147.196:4351 - 192.168.2.36:4480
hrfont size=2font color=#FFProxy/fontfont 
color=#FF+/font 3.00 (Build #246), Date: Thu, 02 Jun 2005 10:40:24 
GMT/font

If you comment out the StrToInt() line in the source code,
it'll appear only once.

-- 
Best regards,
Jack

Thursday, June 2, 2005, 9:13:44 AM, you wrote:

 No attachement here. But you can provide and URL on some server so that 
 anyone willing to have a
 look at your code can. If you don't have any server, emailing it will be good 
 also, for me alone.
 --
 [EMAIL PROTECTED]
 http://www.overbyte.be

 - Original Message - 
 From: Jack [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Thursday, June 02, 2005 2:30 PM
 Subject: Re[2]: [twsocket] Receive result of the first
 ReceiveStr() calltwice-not resolved


 Hello Francois,

 Thanks for the quick reply. You are right. I should check in
 the code. But in this particular test environment, I am receiving
 HTTP/1.x. This I checked from the log.

 I looked at the httpcli code briefly yesterday but failed to
 find the part that parses the http headers (I know it should be there.)

 I have been displaying the logs in a TMemo and yes, I do receive
 a part of the string twice as shown in the log. I didn't call any
 of the functions you mentioned in your earlier emails about what
 could mess up the message pump.

 I have further stripped the test project - very simple now.
 I will email it to you. Please take a look when you have time.

 BTW, are attachments allowed here, or should I send you a private mail?

 -- 
 Best regards,
 Jack

 Thursday, June 2, 2005, 6:43:30 AM, you wrote:

  To avoid difficulties, you should first correctly write your
  GetHTTPReponseStatusCode function to
  correctly parse the answer. You should not simply remove
  HTTP/1.1 but actually check you really
  have that string. I'm sure you think you receive data twice while
  you aren't. You think you receive
  it twice because you don't parse it correctly and you overlooked
  the mechanism that makes TCP stream
  split into several packets and OnDataAvailable events.

  You can have look at the HTTP client component source code (if
  you don't want to use it, look at the
  code and copy what you need to reinvent your wheel).

  Use OutputDebugString to display what you receive in your
  OnDataAvailable event. You'll see that you
  never receive data twice, unless you mess up with the message pump.

  --
  [EMAIL PROTECTED]
  Auteur du freeware ICS - Internet Component Suite
  Auteur du freeware MidWare - Multi-tiers framework
  http://www.overbyte.be



  - Original Message - 
  From: Jack [EMAIL PROTECTED]
  To: ICS support mailing twsocket@elists.org
  Sent: Thursday, June 02, 2005 12:39 AM
  Subject: Re: [twsocket] Receive result of the first
 ReceiveStr() call twice-not resolved


  This problem is still bugging me. I did some further testing
  and find some strange things. In the OnDataAvailable event
  handler, I call the function below to get HTTP status code.
  The HttpReply is the string variable I get from ReceiveStr() call.
  I find that as long as I call this function, I get a part of
  the HTTP reply twice from ReceiveStr() call. Further testing
  shows that this line is teh culprit:
 
Result := StrToInt(s);
 
  If I comment out this line, I don't have a problem (then I don't
  get a result from the function either.)
 
  Any ideas? (Below is the whole function.)
 
  function GetHTTPReponseStatusCode(const HttpReply: String): Integer;
  var i: Integer; s: String;
  begin
Result := -1;
i := Pos(' ', HttpReply);
if i  0 then
begin
  s := Copy(HttpReply, i + 1, Length(HttpReply)); //
 Remove HTTP/1.1  at the beginning
  i := Pos(' ', s); // Remove the trailing text
  if i  0 then
  begin
s := Copy(s, 1, i - 1);
Result := StrToInt(s);
  end;
end;
  end;
 
  -- 
  Best regards,
  Jack
 
   I celebrated a little too early. I am getting this problem again
   in further testing after I changed Close() to CloseDelayed();
   The difference is, I'm not getting result of the first ReceiveStr()
   twice. Instead, I get the result of the second ReceiveStr() twice.
   I think this is because CloseDelayed() delayed the Close().
   What I don't understand is why the buffer isn't cleared after
   ReceiveStr() in both scenarios of Close() and CloseDelayed().
  
   I reason I thought it was fixed is because I tested from
   an allowed IP earlier and got a very

Re: [twsocket] Receive result of the first ReceiveStr() call twice -not resolved

2005-06-01 Thread Jack
This problem is still bugging me. I did some further testing
and find some strange things. In the OnDataAvailable event
handler, I call the function below to get HTTP status code.
The HttpReply is the string variable I get from ReceiveStr() call.
I find that as long as I call this function, I get a part of
the HTTP reply twice from ReceiveStr() call. Further testing
shows that this line is teh culprit:

  Result := StrToInt(s);

If I comment out this line, I don't have a problem (then I don't
get a result from the function either.)

Any ideas? (Below is the whole function.)

function GetHTTPReponseStatusCode(const HttpReply: String): Integer;
var i: Integer; s: String;
begin
  Result := -1;
  i := Pos(' ', HttpReply);
  if i  0 then
  begin
s := Copy(HttpReply, i + 1, Length(HttpReply)); // Remove HTTP/1.1  at 
the beginning
i := Pos(' ', s); // Remove the trailing text
if i  0 then
begin
  s := Copy(s, 1, i - 1);
  Result := StrToInt(s);
end;
  end;
end;

-- 
Best regards,
Jack

 I celebrated a little too early. I am getting this problem again
 in further testing after I changed Close() to CloseDelayed();
 The difference is, I'm not getting result of the first ReceiveStr()
 twice. Instead, I get the result of the second ReceiveStr() twice.
 I think this is because CloseDelayed() delayed the Close().
 What I don't understand is why the buffer isn't cleared after
 ReceiveStr() in both scenarios of Close() and CloseDelayed().

 I reason I thought it was fixed is because I tested from
 an allowed IP earlier and got a very short response back from
 the proxy server. The whole message was retrieved in the first
 ReceiveStr() call so I didn't get a chance to call ReceiveStr()
 twice. I then run the same app on a blocked IP. The proxy sends
 a longer message (the error message) and it is retrieved in
 two ReceiveStr() calls. Then I found that the second ReceiveStr()
 result was duplicated.

 -- 
 Best regards,
 Jack

 Thursday, May 19, 2005, 10:53:49 AM, you wrote:

 J Francois, thanks! This fixed the problem! It's actually in the FAQ:

 J - CloseDelayed

 J Is in most cases the preferred way. It will post a message to
 J itself to close the TWSocket. This means that the socket closure
 J is done outside the code that calls the CloseDelayed, meaning a
 J while later. The message handler will call Close.

 J - Close

 J Attempt to gracefully close the socket. If there is still some
 J data waiting in the buffers it will try to send it. ***Do not use
 J Close from within any TWSocket events, instead use CloseDelayed.***


 J Thursday, May 19, 2005, 2:46:47 AM, you wrote:

 FP Use CloseDelayed instead of Close.

  Hello Wilfried,
 
  Sure. Below is my event handler code. Hope I'm doing something
  wrong, otherwise, it's really strange. TProxyChecker is the owner
  object of the TProxySocket object array. TProxySocket is derived
  from TWSocket.
 
  procedure TProxyChecker.WSocketDataAvailable(Sender: TObject; ErrCode: 
  Word);
  var s: String;
  begin
if ErrCode = 0 then
  with TProxySocket(Sender) do
  begin
s := ReceiveStr();
Log(s);
Close();
  end;
  end;
 
  The destination server is a commercial http proxy server.
  I tried using #13#10 and #13#10#13#10, I different strings
  read back from ReceiveStr. But the second string includes
  the first string in both cases. So it shouldn't be the server
  sending the string twice.
 
  BTW, I'm using the latest ICS.
 
  -- 
  Best regards,
  Jack
 
  Wednesday, May 18, 2005, 3:31:32 PM, you wrote:
 
  WM Hello Jack,
 
  WM Can you show your OnDataAvailable handler ?
  WM Eventually download SocketSpy from 'user made' page and 'hang' it
  WM between client and server. Then you see exacly what is sent by 
  server.
 
  WM ---
  WM Rgds, Wilfried
  WM http://www.mestdagh.biz
 
  WM Wednesday, May 18, 2005, 20:48, Jack wrote:
 
   Hello Francois and all,
 
   I'm using a TWSocket client in LineMode with LineEnd set to #13#10.
   I connect to a HTTP proxy server using CONNECT command. I then get
   a reply back from the HTTP proxy from ReceiveStr()
 
   Things look OK except that I am receiving the data from the first
   ReceiveStr() call twice. I get two WSocketDataAvailable messages for
   3 lines in the HTTP response:
 
 Line 1: HTTP/1.0 200 Connection established
 Line 2: Proxy-agent: Proxy+ 3.00
 Line 3: (Blank line)
 
   However, I'm getting the first ReceiveStr() result twice, see below:
   I'm getting HTTP/1.0 200 Connection established twice:
 
   5/18/2005 2:36:43 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 
   ErrCode=0
   5/18/2005 2:36:43 PM HTTP/1.0 200 Connection established
   5/18/2005 2:36:43 PM
   5/18/2005 2:36:43 PM
   5/18/2005 2:36:43 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 
   ErrCode=0
   5/18/2005 2:36:43 PM HTTP/1.0 200 Connection established
   Proxy-agent: Proxy+ 3.00
 
 
   I then changed LineEnd to #13#10#13#10, I still get the result

[twsocket] TCP-based DNS resolution component?

2005-05-25 Thread Jack
Hi Francois,

I didn't receive any reply so I went ahead and added
tcp support in the DNSQuery component. If you are interested
I can email you the updated file so that you can review
the code and add to your distribution if you like.

Thanks,
Jack

===8==Original message text===
Hello all,

I didn't see the option of choosing TCP in ICS's DNS client
component. I suppose it's UDP only. I wonder if there is a
component that resolves DNS with TCP? I didn't see one on
the user made page.

-- 
Best regards,
Jack



-- 
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


[twsocket] TCP-based DNS resolution component?

2005-05-23 Thread Jack
Hello all,

I didn't see the option of choosing TCP in ICS's DNS client
component. I suppose it's UDP only. I wonder if there is a
component that resolves DNS with TCP? I didn't see one on
the user made page.

-- 
Best regards,
Jack


-- 
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[2]: [twsocket] Receive result of the first ReceiveStr() call twice -not resolved

2005-05-20 Thread Jack
Thanks Francois.

I double-checked and didn't see any calls to ProcessMessages
or ShowMessage, etc.

I'll make a simplified version and send the code in private email.

Jack

Friday, May 20, 2005, 3:50:18 AM, you wrote:

FP I still persist saying the you probably call the message pump
FP directly or indirectly (for example
FP your Log() function, or any component you use for display).
FP I suggest you make a stripped down version of your program,
FP just he bare minimum in a small project.
FP If the problem persist with this small project, make it
FP available for download somewhere. If I have
FP time, I'll look at it.

FP --
FP Contribute to the SSL Effort. Visit
FP http://www.overbyte.be/eng/ssl.html
FP --
FP [EMAIL PROTECTED]
FP Author of ICS (Internet Component Suite, freeware)
FP Author of MidWare (Multi-tier framework, freeware)
FP http://www.overbyte.be


FP - Original Message - 
FP From: Jack [EMAIL PROTECTED]
FP To: ICS support mailing twsocket@elists.org
FP Sent: Thursday, May 19, 2005 9:31 PM
FP Subject: [twsocket] Receive result of the first ReceiveStr() call twice 
-not resolved


 I celebrated a little too early. I am getting this problem again
 in further testing after I changed Close() to CloseDelayed();
 The difference is, I'm not getting result of the first ReceiveStr()
 twice. Instead, I get the result of the second ReceiveStr() twice.
 I think this is because CloseDelayed() delayed the Close().
 What I don't understand is why the buffer isn't cleared after
 ReceiveStr() in both scenarios of Close() and CloseDelayed().

 I reason I thought it was fixed is because I tested from
 an allowed IP earlier and got a very short response back from
 the proxy server. The whole message was retrieved in the first
 ReceiveStr() call so I didn't get a chance to call ReceiveStr()
 twice. I then run the same app on a blocked IP. The proxy sends
 a longer message (the error message) and it is retrieved in
 two ReceiveStr() calls. Then I found that the second ReceiveStr()
 result was duplicated.

 -- 
 Best regards,
 Jack

 Thursday, May 19, 2005, 10:53:49 AM, you wrote:

 J Francois, thanks! This fixed the problem! It's actually in the FAQ:

 J - CloseDelayed

 J Is in most cases the preferred way. It will post a message to
 J itself to close the TWSocket. This means that the socket closure
 J is done outside the code that calls the CloseDelayed, meaning a
 J while later. The message handler will call Close.

 J - Close

 J Attempt to gracefully close the socket. If there is still some
 J data waiting in the buffers it will try to send it. ***Do not use
 J Close from within any TWSocket events, instead use CloseDelayed.***


 J Thursday, May 19, 2005, 2:46:47 AM, you wrote:

 FP Use CloseDelayed instead of Close.

  Hello Wilfried,
 
  Sure. Below is my event handler code. Hope I'm doing something
  wrong, otherwise, it's really strange. TProxyChecker is the owner
  object of the TProxySocket object array. TProxySocket is derived
  from TWSocket.
 
  procedure TProxyChecker.WSocketDataAvailable(Sender: TObject; ErrCode: 
  Word);
  var s: String;
  begin
if ErrCode = 0 then
  with TProxySocket(Sender) do
  begin
s := ReceiveStr();
Log(s);
Close();
  end;
  end;
 
  The destination server is a commercial http proxy server.
  I tried using #13#10 and #13#10#13#10, I different strings
  read back from ReceiveStr. But the second string includes
  the first string in both cases. So it shouldn't be the server
  sending the string twice.
 
  BTW, I'm using the latest ICS.
 
  -- 
  Best regards,
  Jack
 
  Wednesday, May 18, 2005, 3:31:32 PM, you wrote:
 
  WM Hello Jack,
 
  WM Can you show your OnDataAvailable handler ?
  WM Eventually download SocketSpy from 'user made' page and 'hang' it
  WM between client and server. Then you see exacly what is sent by 
  server.
 
  WM ---
  WM Rgds, Wilfried
  WM http://www.mestdagh.biz
 
  WM Wednesday, May 18, 2005, 20:48, Jack wrote:
 
   Hello Francois and all,
 
   I'm using a TWSocket client in LineMode with LineEnd set to #13#10.
   I connect to a HTTP proxy server using CONNECT command. I then get
   a reply back from the HTTP proxy from ReceiveStr()
 
   Things look OK except that I am receiving the data from the first
   ReceiveStr() call twice. I get two WSocketDataAvailable messages for
   3 lines in the HTTP response:
 
 Line 1: HTTP/1.0 200 Connection established
 Line 2: Proxy-agent: Proxy+ 3.00
 Line 3: (Blank line)
 
   However, I'm getting the first ReceiveStr() result twice, see below:
   I'm getting HTTP/1.0 200 Connection established twice:
 
   5/18/2005 2:36:43 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 
   ErrCode=0
   5/18/2005 2:36:43 PM HTTP/1.0 200 Connection established
   5/18/2005 2:36:43 PM
   5/18/2005 2:36:43 PM
   5/18/2005 2:36:43 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 
   ErrCode=0
   5/18/2005 2:36:43 PM HTTP/1.0 200 Connection established
   Proxy-agent

[twsocket] Receive result of the first ReceiveStr() call twice - not resolved

2005-05-19 Thread Jack
I celebrated a little too early. I am getting this problem again
in further testing after I changed Close() to CloseDelayed();
The difference is, I'm not getting result of the first ReceiveStr()
twice. Instead, I get the result of the second ReceiveStr() twice.
I think this is because CloseDelayed() delayed the Close().
What I don't understand is why the buffer isn't cleared after
ReceiveStr() in both scenarios of Close() and CloseDelayed().

I reason I thought it was fixed is because I tested from
an allowed IP earlier and got a very short response back from
the proxy server. The whole message was retrieved in the first
ReceiveStr() call so I didn't get a chance to call ReceiveStr()
twice. I then run the same app on a blocked IP. The proxy sends
a longer message (the error message) and it is retrieved in
two ReceiveStr() calls. Then I found that the second ReceiveStr()
result was duplicated.

-- 
Best regards,
Jack

Thursday, May 19, 2005, 10:53:49 AM, you wrote:

J Francois, thanks! This fixed the problem! It's actually in the FAQ:

J - CloseDelayed

J Is in most cases the preferred way. It will post a message to
J itself to close the TWSocket. This means that the socket closure
J is done outside the code that calls the CloseDelayed, meaning a
J while later. The message handler will call Close.

J - Close

J Attempt to gracefully close the socket. If there is still some
J data waiting in the buffers it will try to send it. ***Do not use
J Close from within any TWSocket events, instead use CloseDelayed.***


J Thursday, May 19, 2005, 2:46:47 AM, you wrote:

FP Use CloseDelayed instead of Close.

 Hello Wilfried,
 
 Sure. Below is my event handler code. Hope I'm doing something
 wrong, otherwise, it's really strange. TProxyChecker is the owner
 object of the TProxySocket object array. TProxySocket is derived
 from TWSocket.
 
 procedure TProxyChecker.WSocketDataAvailable(Sender: TObject; ErrCode: 
 Word);
 var s: String;
 begin
   if ErrCode = 0 then
 with TProxySocket(Sender) do
 begin
   s := ReceiveStr();
   Log(s);
   Close();
 end;
 end;
 
 The destination server is a commercial http proxy server.
 I tried using #13#10 and #13#10#13#10, I different strings
 read back from ReceiveStr. But the second string includes
 the first string in both cases. So it shouldn't be the server
 sending the string twice.
 
 BTW, I'm using the latest ICS.
 
 -- 
 Best regards,
 Jack
 
 Wednesday, May 18, 2005, 3:31:32 PM, you wrote:
 
 WM Hello Jack,
 
 WM Can you show your OnDataAvailable handler ?
 WM Eventually download SocketSpy from 'user made' page and 'hang' it
 WM between client and server. Then you see exacly what is sent by server.
 
 WM ---
 WM Rgds, Wilfried
 WM http://www.mestdagh.biz
 
 WM Wednesday, May 18, 2005, 20:48, Jack wrote:
 
  Hello Francois and all,
 
  I'm using a TWSocket client in LineMode with LineEnd set to #13#10.
  I connect to a HTTP proxy server using CONNECT command. I then get
  a reply back from the HTTP proxy from ReceiveStr()
 
  Things look OK except that I am receiving the data from the first
  ReceiveStr() call twice. I get two WSocketDataAvailable messages for
  3 lines in the HTTP response:
 
Line 1: HTTP/1.0 200 Connection established
Line 2: Proxy-agent: Proxy+ 3.00
Line 3: (Blank line)
 
  However, I'm getting the first ReceiveStr() result twice, see below:
  I'm getting HTTP/1.0 200 Connection established twice:
 
  5/18/2005 2:36:43 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 
  ErrCode=0
  5/18/2005 2:36:43 PM HTTP/1.0 200 Connection established
  5/18/2005 2:36:43 PM
  5/18/2005 2:36:43 PM 
  5/18/2005 2:36:43 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 
  ErrCode=0
  5/18/2005 2:36:43 PM HTTP/1.0 200 Connection established
  Proxy-agent: Proxy+ 3.00
 
 
  I then changed LineEnd to #13#10#13#10, I still get the result of
  the first ReceiveStr() twice, this time the result is two lines:
 
HTTP/1.0 200 Connection established
Proxy-agent: Proxy+ 3.00
(Blank line)
 
  5/18/2005 2:40:11 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 
  ErrCode=0
  5/18/2005 2:40:11 PM HTTP/1.0 200 Connection established
  Proxy-agent: Proxy+ 3.00
 
 
  5/18/2005 2:40:11 PM 
  5/18/2005 2:40:11 PM 
  5/18/2005 2:40:11 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 
  ErrCode=0
  5/18/2005 2:40:11 PM HTTP/1.0 200 Connection established
  Proxy-agent: Proxy+ 3.00
 
 
  It seems that, somehow the first ReceiveStr() didn't remove the data
  from the buffer. Or am I missing anything?
 
 
  -- 
  Best regards,
  Jack
 
 
 
 
 
 
 -- 
 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


[twsocket] Receive result of the first ReceiveStr() call twice

2005-05-18 Thread Jack
Hello Francois and all,

I'm using a TWSocket client in LineMode with LineEnd set to #13#10.
I connect to a HTTP proxy server using CONNECT command. I then get
a reply back from the HTTP proxy from ReceiveStr()

Things look OK except that I am receiving the data from the first
ReceiveStr() call twice. I get two WSocketDataAvailable messages for
3 lines in the HTTP response:

  Line 1: HTTP/1.0 200 Connection established
  Line 2: Proxy-agent: Proxy+ 3.00
  Line 3: (Blank line)

However, I'm getting the first ReceiveStr() result twice, see below:
I'm getting HTTP/1.0 200 Connection established twice:

5/18/2005 2:36:43 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 ErrCode=0
5/18/2005 2:36:43 PM HTTP/1.0 200 Connection established
5/18/2005 2:36:43 PM
5/18/2005 2:36:43 PM 
5/18/2005 2:36:43 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 ErrCode=0
5/18/2005 2:36:43 PM HTTP/1.0 200 Connection established
Proxy-agent: Proxy+ 3.00


I then changed LineEnd to #13#10#13#10, I still get the result of
the first ReceiveStr() twice, this time the result is two lines:

  HTTP/1.0 200 Connection established
  Proxy-agent: Proxy+ 3.00
  (Blank line)

5/18/2005 2:40:11 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 ErrCode=0
5/18/2005 2:40:11 PM HTTP/1.0 200 Connection established
Proxy-agent: Proxy+ 3.00


5/18/2005 2:40:11 PM 
5/18/2005 2:40:11 PM 
5/18/2005 2:40:11 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 ErrCode=0
5/18/2005 2:40:11 PM HTTP/1.0 200 Connection established
Proxy-agent: Proxy+ 3.00


It seems that, somehow the first ReceiveStr() didn't remove the data
from the buffer. Or am I missing anything?


-- 
Best regards,
Jack


-- 
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[2]: [twsocket] Receive result of the first ReceiveStr() call twice

2005-05-18 Thread Jack
Hello Francois,

Thanks for the quick reply.

No, I don't have any message handler of my own in my code.
I create an object as the owner of an array of TWSocket objects.
I assign the even handler of the TWSocket objects to a member
function of that owner object and call ReceiveStr() in the
OnDataAvailable handler. Any other reasons that you can think
of that could cause this problem?

My component verifies if a HTTP proxies supports CONNECT
on port 443. I don't think HTTPCli component does what I
want to do ...

-- 
Best regards,
Jack

Wednesday, May 18, 2005, 3:59:06 PM, you wrote:

FP Usually, when you receive the same data twice, it is because you called the
FP message pump from one the ICS component event handler. Never call directly
FP or indirectly ( ShowMessage, MessageBox,...) from an event handler that is
FP called by hardware (a data packet comes from the network) unless you really
FP know what you are doing.

FP btw: Do not reinvent the wheel, use the HTTP component !


FP - Original Message - 

 Hello Francois and all,

 I'm using a TWSocket client in LineMode with LineEnd set to #13#10.
 I connect to a HTTP proxy server using CONNECT command. I then get
 a reply back from the HTTP proxy from ReceiveStr()

 Things look OK except that I am receiving the data from the first
 ReceiveStr() call twice. I get two WSocketDataAvailable messages for
 3 lines in the HTTP response:

   Line 1: HTTP/1.0 200 Connection established
   Line 2: Proxy-agent: Proxy+ 3.00
   Line 3: (Blank line)

 However, I'm getting the first ReceiveStr() result twice, see below:
 I'm getting HTTP/1.0 200 Connection established twice:

 5/18/2005 2:36:43 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480
FP ErrCode=0
 5/18/2005 2:36:43 PM HTTP/1.0 200 Connection established
 5/18/2005 2:36:43 PM
 5/18/2005 2:36:43 PM
 5/18/2005 2:36:43 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480
FP ErrCode=0
 5/18/2005 2:36:43 PM HTTP/1.0 200 Connection established
 Proxy-agent: Proxy+ 3.00


 I then changed LineEnd to #13#10#13#10, I still get the result of
 the first ReceiveStr() twice, this time the result is two lines:

   HTTP/1.0 200 Connection established
   Proxy-agent: Proxy+ 3.00
   (Blank line)

 5/18/2005 2:40:11 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480
FP ErrCode=0
 5/18/2005 2:40:11 PM HTTP/1.0 200 Connection established
 Proxy-agent: Proxy+ 3.00


 5/18/2005 2:40:11 PM
 5/18/2005 2:40:11 PM
 5/18/2005 2:40:11 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480
FP ErrCode=0
 5/18/2005 2:40:11 PM HTTP/1.0 200 Connection established
 Proxy-agent: Proxy+ 3.00


 It seems that, somehow the first ReceiveStr() didn't remove the data
 from the buffer. Or am I missing anything?


-- 
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[2]: [twsocket] Receive result of the first ReceiveStr() call twice

2005-05-18 Thread Jack
Hello Wilfried,

Sure. Below is my event handler code. Hope I'm doing something
wrong, otherwise, it's really strange. TProxyChecker is the owner
object of the TProxySocket object array. TProxySocket is derived
from TWSocket.

procedure TProxyChecker.WSocketDataAvailable(Sender: TObject; ErrCode: Word);
var s: String;
begin
  if ErrCode = 0 then
with TProxySocket(Sender) do
begin
  s := ReceiveStr();
  Log(s);
  Close();
end;
end;

The destination server is a commercial http proxy server.
I tried using #13#10 and #13#10#13#10, I different strings
read back from ReceiveStr. But the second string includes
the first string in both cases. So it shouldn't be the server
sending the string twice.

BTW, I'm using the latest ICS.

-- 
Best regards,
Jack

Wednesday, May 18, 2005, 3:31:32 PM, you wrote:

WM Hello Jack,

WM Can you show your OnDataAvailable handler ?
WM Eventually download SocketSpy from 'user made' page and 'hang' it
WM between client and server. Then you see exacly what is sent by server.

WM ---
WM Rgds, Wilfried
WM http://www.mestdagh.biz

WM Wednesday, May 18, 2005, 20:48, Jack wrote:

 Hello Francois and all,

 I'm using a TWSocket client in LineMode with LineEnd set to #13#10.
 I connect to a HTTP proxy server using CONNECT command. I then get
 a reply back from the HTTP proxy from ReceiveStr()

 Things look OK except that I am receiving the data from the first
 ReceiveStr() call twice. I get two WSocketDataAvailable messages for
 3 lines in the HTTP response:

   Line 1: HTTP/1.0 200 Connection established
   Line 2: Proxy-agent: Proxy+ 3.00
   Line 3: (Blank line)

 However, I'm getting the first ReceiveStr() result twice, see below:
 I'm getting HTTP/1.0 200 Connection established twice:

 5/18/2005 2:36:43 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 ErrCode=0
 5/18/2005 2:36:43 PM HTTP/1.0 200 Connection established
 5/18/2005 2:36:43 PM
 5/18/2005 2:36:43 PM 
 5/18/2005 2:36:43 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 ErrCode=0
 5/18/2005 2:36:43 PM HTTP/1.0 200 Connection established
 Proxy-agent: Proxy+ 3.00


 I then changed LineEnd to #13#10#13#10, I still get the result of
 the first ReceiveStr() twice, this time the result is two lines:

   HTTP/1.0 200 Connection established
   Proxy-agent: Proxy+ 3.00
   (Blank line)

 5/18/2005 2:40:11 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 ErrCode=0
 5/18/2005 2:40:11 PM HTTP/1.0 200 Connection established
 Proxy-agent: Proxy+ 3.00


 5/18/2005 2:40:11 PM 
 5/18/2005 2:40:11 PM 
 5/18/2005 2:40:11 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 ErrCode=0
 5/18/2005 2:40:11 PM HTTP/1.0 200 Connection established
 Proxy-agent: Proxy+ 3.00


 It seems that, somehow the first ReceiveStr() didn't remove the data
 from the buffer. Or am I missing anything?


 -- 
 Best regards,
 Jack






-- 
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[2]: [twsocket] Threaded client?

2005-05-18 Thread Jack
Hello Francois,

I'm not using a TDataModule but as I mentioned in my other email,
I created an object to own the array of TWSocket objects.

Now I have a new question that relates to the dependency of the
main form. I'm reusing the sockets. So when a socket is
disconnected, I assign a different IP and connect again. I understand
that I can not do this in the OnSessionClosed event handler (or
that didn't work.) Instead, I need to post a message to the main
form, and reconnect in the windows message handler. This also
introduces a dependency to the main form, and adds and some code
in the main form unit. Is there any other way to defer the call to
the Connect function so that it will happen after the code exits
the OnSessionClosed event handler? I know I can create a hidden
window in the owner object but I would avoid doing that if there
is an easier way.

-- 
Best regards,
Jack

 The reason I was thinking of a multi-threaded client is that
 I want to isolate this module with the main form.

FP No need to have multithread for that. Just put your TWSocket into a
FP TDataModule. It's enough.
FP You can evn create them dynamicall in a pure .pas unit.

FP fyi: Message handlers can be put everywhere, it doesn't matter.


FP - Original Message - 
 Hello Francois and all,

 I saw a thread server sample in ICS package but did not
 see any sample for threaded client. I understand that with
 ICS I don't have to do multi-threading. The reason I was
 thinking of a multi-threaded client is that I want to isolate
 this module with the main form. The module is supposed to
 create multiple sockets to test a group of servers. I suppose
 this can be achieved with an array of wsocket objects in a
 single-threaded application but the socket will have to have
 something to do with the main form? For example, parent-ed by
 the main form, or the message handlers defined in the main form.
 (I could be wrong.) That's why I'm thinking of using a separate
 group of threads to do the server check. I wonder if there are
 samples for the client.

 -- 
 Best regards,
 Jack


-- 
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


[twsocket] new httpcli exception

2005-05-01 Thread Jack
Hi Francois and all,

I recompiled an old project of mine with the latest
ICS on D5. I'm getting this error during run time, that
I have never got before:

  Project Test.exe raised exception class EHttpException with
  message 'Protocol  not implemented'. Process stopped. use
  Step or Run to continue.

Were there any changes introduced in recent versions of httpcli
component? Or, any ideas what this exception is about?

-- 
Best regards,
Jack


-- 
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


Fwd: [twsocket] new httpcli exception

2005-05-01 Thread Jack

It seems that now THttpCli.URL now requires prefix of
http:// or https://. I used to use url without those
and it seems to have worked with previous versions of
httpcli.

===8==Original message text===
Hi Francois and all,

I recompiled an old project of mine with the latest
ICS on D5. I'm getting this error during run time, that
I have never got before:

  Project Test.exe raised exception class EHttpException with
  message 'Protocol  not implemented'. Process stopped. use
  Step or Run to continue.

Were there any changes introduced in recent versions of httpcli
component? Or, any ideas what this exception is about?



-- 
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[2]: [twsocket] new httpcli exception

2005-05-01 Thread Jack
Hello Francois,

In one case, I'm using a proxy. In another case,
I'm not. The moment I added http://; before the URL,
it worked again.

-- 
Best regards,
Jack

Sunday, May 1, 2005, 6:10:36 AM, you wrote:

FP Are you using a proxy or not ?
FP Are you using authentication ?
FP --
FP [EMAIL PROTECTED]
FP http://www.overbyte.be

FP - Original Message - 
FP From: Jack [EMAIL PROTECTED]
 
 It seems that now THttpCli.URL now requires prefix of
 http:// or https://. I used to use url without those
 and it seems to have worked with previous versions of
 httpcli.
 
 ===8==Original message text===
 Hi Francois and all,
 
 I recompiled an old project of mine with the latest
 ICS on D5. I'm getting this error during run time, that
 I have never got before:
 
   Project Test.exe raised exception class EHttpException with
   message 'Protocol  not implemented'. Process stopped. use
   Step or Run to continue.
 
 Were there any changes introduced in recent versions of httpcli
 component? Or, any ideas what this exception is about?


-- 
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[2]: [twsocket] NOFORMS and TWSocketServer

2005-04-10 Thread Jack
Thanks Wilfried and Arno.

I did have NOFORMS defined in the project settings.
That's how I got 111KB in the original project. Then I
just modified it.

I tried excluding the uses units one by one and it seems
that I'm having the minimum. What I have (in all units) are:

  Windows, SysUtils, Messages, WSocket, WsocketS;

I still can not make the file smaller than 300+KB :(

BTW Wilfried, it seems that TWSocket does support more
than 1 client. The ConSrv sample is a telnet server and I
tried with 2 telnet clients, both worked fine :)

-- 
Best regards,
Jack

Sunday, April 10, 2005, 1:54:18 PM, you wrote:

WM Hello Jack,

 With NOFORMS defined, the application size is about 111KB.

WM the NOFORMS exclude some units in the uses clause to decrease the
WM filesize.

 After I replaced TWSocket with TWSocketServer, the file size
 becomes over 300KB. I went through the uses clauses. It's
 the minimum already. I can not make it as small as it was.

WM Hmm I suspect some unit can be excluded in uses clause because not the
WM TWSocketServer increase with 200 kb.

 1. Why is TWSocket used for the server socket, instead of
TWSocketServer?

WM I think this is older demo. TWSocketServer did not exists in the
WM beginning.

If so, what's the difference of using it and TWSocketServer for
server sockets? In other words, when should I use TWSocket and when
to use TWSocketServer?

WM Use TWSocketServer for TCP server sockets. TWSocketServer use TWSocket
WM as server socket. You can use TWSocket of course but then you have to
WM reinvent the wheel, holding client connections and all other goodies
WM that are implemented in TWSocketServer.

WM Maybe there is one exception (but I think you only gain a few kb of exe
WM size), and that is if you only wants to have 1 client.

WM ---
WM Rgds, Wilfried
WM http://www.mestdagh.biz




-- 
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