Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-05

portable SelectText replacement

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Hartmut Eilers

Hi Folks,

I have the following code which I want to port to Windows, but I have no idea how the functionality of SelectText may be done in Windows. I googled a lot but unfortunately I found nothing that helped me out. How is something like that handled under Windows ?

	{$I-}
		if debug then writeLOG('Sock2Text');
		Sock2Text(sock,sin,sout);
		if debug then writeLOG('reset');
		reset(sin);
		//if debug then writeLOG('rewrite');
		//rewrite(sout);
	{$I+}
		if debug then WriteLOG('Reading requests...');
		if (SelectText(sin,10000)>0) then begin
			Addr_len:=SizeOf(cli_addr);
			csock:=accept(sock, cli_addr,Addr_len);
			Sock2Text(csock,ccsin,ccsout);
			reset(ccsin);
			rewrite(ccsout);
			process_request;

Thanks for your help
Hartmut

Henry Vermaak
to Hartmut Eilers
Hartmut Eilers wrote 24 lines
Hi Folks, I have the following code which I want to port to Windows, but I have no idea how the functionality of SelectText may be done in Windows. I googled a lot but unfortunately I found nothing that helped me out. How is something like that handled under Windows ?        {$I-}                if debug then writeLOG('Sock2Text');                Sock2Text(sock,sin,sout);                if debug then writeLOG('reset');                reset(sin);                //if debug then writeLOG('rewrite');                //rewrite(sout);        {$I+}                if debug then WriteLOG('Reading requests...');                if (SelectText(sin,10000)>0) then begin                        Addr_len:=SizeOf(cli_addr);                        csock:=accept(sock, cli_addr,Addr_len);                        Sock2Text(csock,ccsin,ccsout);                        reset(ccsin);                        rewrite(ccsout);                        process_request;

You can probably get the same effect by using overlapped i/o on the file and one of the wait functions, like WaitForSingleObject.

Henry