[twsocket] connect to IDE without app running ?

Wilfried Mestdagh wilfried_sonal@compuserve.com
Tue, 13 Jun 2000 18:05:25 +0200


Hello,

I found a workaround but I'm not sure it is the right place/way. To be sort
it is compoennt that use TWSocketerver inside. I have 'Active' property
witch I had set to True in the object instpector and it do following:

procedure TCustomCiaServer.SetActive(value: boolean);
begin
  if value <> FActive then
  begin
    FActive := value;
    PostMessage(Handle, WM_CONNECT, 0, 0);

This code is of course also executed at design time. The component has it
own message handler witch look like this:

procedure TCustomCiaServer.WndProc(var MsgRec: TMessage);
begin
  with MsgRec do
    case Msg of
      WM_CONNECT:    WMConnect;
      ...
      else Result := DefWindowProc(Handle, Msg, wParam, lParam);

While WMConnect does nothing else than closing the WSocketServeer if
neccesary but it cals FWSocketServer.LISTEN if closed. This means that the
TWSocketServer is going to listen while the project is open in IDE WITHOUT
that the application runs because I had set the Active property to True;

I have fixed this in the message handler as this:

procedure TCustomCiaServer.WndProc(var MsgRec: TMessage);
begin
  if csDesigning in ComponentState then Exit;
  with MsgRec do
    case Msg of
      WM_CONNECT:    WMConnect;
      ...

Do you think this is the right place ????

thanks in advance, Wilfried


> -----Original Message-----
> From: twsocket-admin@elists.org [mailto:twsocket-admin@elists.org]On
> Behalf Of Wilfried Mestdagh
> Sent: maandag 12 juni 2000 23:16
> To: TWSocket Mailing List
> Subject: [twsocket] connect to IDE without app running ?
>
>
>
> Hello,
>
> I did something terrible and can not find it. I hope someone can advice to
> track down the problem. I have project with component with
> TWSocketServer in
> it. From moment I open the project in the IDE without running the
> application I can connect with telnet.exe to port 10000 where no
> application
> is listening on (nothing to see in netstat also). From that
> moment on delphi
> IDE do exception error and dissapears.
>
> If I run the program and let the server listen on port 10000 I get the
> familiar 10048. If I let it listen on other port then the program works
> normal. Note I still can connect to 10000 but then Delphi IDE
> will dissapear
> with execptions and the running program witch is in debug sesson will
> dessapear also.
>
> Note that port 10000 is a port I used to test the component.
>
> If I open other or create new project with same component this will not
> happen.
>
> It looks that when I open the project I already activate
> TWSocketServer but
> how can this be tru ?
>
> thanks in advance, Wilfried