[twsocket] OT: Code signing certificates

2016-12-13 Thread Michael Gasser


Hi Richard

i sign my apps with
http://codesigning.ksoftware.net/

f.e. four years for $268.

ksoftware is a Comodo reseller, Comodo will check your identity.

Regards
Michael


Message: 4
Date: Mon, 12 Dec 2016 20:45:18 +
From: Richard Gallois 
To: ICS support mailing 
Subject: Re: [twsocket] OT: Code signing certificates
Message-ID:

Re: [twsocket] how to use ICS correctly

2016-01-27 Thread Michael Gasser

ICS support mailing 

Hi Simon

I run a card game. Protocol tcp. Users can play, chat, and send pictures 
/ (very large) files. It's p2p.  Every game can act as a server (if 
either the user opens a port  or UPnP is enabled (then it's done by the 
game)).


Login: I use three servers - one main server and two backup servers. 
Users log in to one of the three servers. If the game acts as server, it 
posts it's port. If login is successful, the game gets the list of all 
servers (games) [IP:port] currently online - it connects to all these 
servers.
[ After successful login I could shut down alle three login servers. 
Users who are online remain online - as everything is p2p. ]
If you have a large number of users, you can either use different rooms 
(that is what I do - I limit my rooms to about 100 users) or your chat 
software just connects to a subset of all available servers.


If a game acts as server it knows about all users in the room. If not, 
the game mus update the list of all users currently online via one of 
the servers.


As in a network a lot of thing may go wrong every server S periodically 
sends

> the number of all servers it sees
> a f.e. md5 signature of the list of all servers
to every server in the room. If one of the servers K sees another number 
of servers or calculates another signature (sees the same number of 
servers but at least one is different) then K and S exchange the full 
list of servers. After that K and S connect to the "additional" servers.


Data from A to B is always sent directly (if A or B act as server) 
or(/and additonally) from A to at least one (fast) server (game) and 
from this server to B. A knows about the fastest paths from A to B (by 
checking "fast paths").


Chat messages: You must either "time stamp" each message in a p2p system 
- or just use the "fastest" server (game) currently online as chat server.


Files: If a user A sends a file f to B, then after successful 
transmission A and B act as file server for the file f: If A or B send 
this file f to another game C, then C "asks" all games that are directly 
connected if they are server for f. If A and B are connected to C then C 
receives a YES from A and B => C downloads f from A and B.


Data: As in a p2p system

-> every server (game) might logoff anytime (packet might get lost) and
-> data from X  and Y is not always sent via the same server (it can 
happen that X sends D1 D2 - Y receives D2 D1)


I enumerate every packet sent from X to Y.  Y buffers the received 
packets. If Y receives D1 D2 D4 then D1 D2 will be parsed and D4 
buffered. If after a certain time (dependent on the "path time" X-Y) D3 
is still not available to Y, then Y asks X to resend D3.


My packets look like this : [number of packet][length of 
packet][data][digital signature]


Best regards
Michael





Am 27.01.2016 um 14:19 schrieb Simon Lewis:

Am currently using ICS for a large chat system but now my service is getting 
bigger am starting to worry I not really done the socket code best I can below 
is the server side for receiving string commands also other idea am interested 
in looking into is a main server that controls other servers so can host 
multiple servers around world and main server will link them all and client 
will know were to connect.

procedure TComServer.SocketServerDataAvailable(Sender: TObject; ErrCode: Word);
begin
   with Sender as TWSocketClient do
   begin
  RunCommand(ReceiveStr, Sender as TWSocketClient);
   end;
end;

then the run common would split the string command in there own sections and 
read from array and assign correct string to dat[id]

procedure TComServer.RunCommand(comdata: string; rSocket: TWSocketClient);
var
   command: string;
   dat: array [0..50] of string;
begin
   { INCOMING ENCODED DATA STRING }
   comdata := DecodeStr(comdata);

   { DECODE INCOMING DATA STRING }
   while DecodeCommand(comdata, command, dat) do begin
   case StrToIntDef(command, -1) of
  00: LoginToService(dat[0], rSocket);
end;
end;

now am starting to think maybe string is not a good way to go about this on a 
large scale service so am wondering if anyone else has ever built a chat system 
and what methods did you use?, any information be great. Thanks a lot

Yours
Simon


--
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] ICS RAD Studio XE7

2014-11-18 Thread Michael Gasser (privat)



Good morning Christian

install http://wiki.overbyte.be/arch/icsv8w.zip (ICS-V8 Snapshot. Rev 
#1236 Date: 2014-09-03T10:23:42: [angus] Added packages and project 
groups to support Delphi XE7) from 
http://wiki.overbyte.be/wiki/index.php/ICS_Download.


Have fun ;-).

Best regards
Michael

Am 19.11.2014 05:12, schrieb Christian Giesen:

Good day all,

We have just upgraded from RAD Studio XE5 to XE7. We use your ICS
components quite extensively. Can you tell me when you will have a release
for XE7? This link claims that ICS 8 Gold supports XE7 but the latest
packages in this version only go up to XE5.

http://wiki.overbyte.be/wiki/index.php/ICS_Download

The home page still has the ICS 8 Gold as the latest available version.

I have tried to access the link indicated in the above web page but the
link is either dead or takes so long to access that it eventually times out
with the usual URL timeout errors: http://svn.overbyte.be:8443/svn/ics/trunk

Any advice would be greatly appreciated.

​Thanking you in advance.

Christian Giesen
Managing Member
Express Talent

EMail: ch...@xt.co.za
Tel: +27 31 776 4952
Cell: +27 82 5745566

This message contains private and confidential Information. If you are not
the intended addressee indicated in this message or you are not responsible
for the delivery of such messages to the intended recipient, you may not
copy or deliver this message to anyone. You may not use any information
gleaned from this message for the benefit or promotion of yourself or your
organization. If such is the case, please destroy this message immediately
and kindly notify the sender by return of E-Mail. Express Talent cc takes
no responsibility whatsoever resulting in you misusing information
contained in this message and doing so may render you liable for the
consequences of misusing said content of this E-Mail message.


--
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] (no subject)

2014-09-26 Thread Michael Gasser (privat)


Download the traceroute samples from
http://www.overbyte.be/frame_index.html

f.e.
PINGTHRD.ZIP, TRACEROUTE, TRACEROUTE II

I think this will help.

Regards Michael

Am 26.09.2014 08:52, schrieb rajesh gupta:

How to find the pinf parametrs via twsocket ie in client mode
ttl and time in ms


--
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] Error in Sending mail

2014-04-16 Thread Michael Gasser


Hi PL

I use Delphi - but I am pretty sure the C++ sample works (and the form 
looks) the same...


When I run IcsMailSnd, I see a form with quite a lot of buttons in the upper 
right corner.


After you had filled in the values for host, username a.s.o.,  did you click 
on these buttons or just wait ;-) ?


1. Fill in the values for host, username a.s.o.
2. Click Connect and WAIT for the smtp servers response (server response: 
see TMemo DisplayMemo - at the bottom of your form).
3. Then click Ehlo (Extended Helo), wait for the response, click Auth, wait 
again, press Mail, wait, then press the Quit button.


http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol


Best regards
Michael




- Original Message - 
From: IMAGE cont...@image-zafar.com

To: twsocket@lists.elists.org
Sent: Wednesday, April 16, 2014 8:40 AM
Subject: [twsocket] Error in Sending mail



Hello,



After following an advise on a C++ forum (I use Builder C++), I download
ICS.



In first, I try to use the example IcsMailSnd.dproj



I enter my username and password, in SmtpCli (I don't need SSL).



When I launch the program, I enter the name of my Smtp server, the port
(587), my mail address in From, and an address in To .



I think it connected to the server, because I don't have any error 
message,

the From is OK, but I have an error message for Receipt (I try few address
of different domains, and it's the same message) : This domain isn't in 
our

allowed list.



I contact our webmaster, we verify with WireShark, and our webmaster tell 
me

that there isn't any authentification, but I have put the values
SmtpAuthlogin, or SmtpAuthPlain on propriety AuthType of SmtpCli 



May you advise me to solve this problem ?



Very cordially.

PL



--
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] Error in Sending mail

2014-04-16 Thread Michael Gasser


Hi PL

if you use ICS to send an eMail f.e. from within a CGI, then you simply 
could use the SYNC SMTP client version SyncSmtpCli to send an eMail:


emailstatus : integer;
success : boolean;


   emailstatus := 1;
   Success := SyncSmtpCli1.ConnectSync;
   if not Success then goto wehaveaproblem;

   emailstatus := 2;
   Success := SyncSmtpCli1.EhloSync;
   if not Success then goto wehaveaproblem;

   emailstatus := 3;
   Success := SyncSmtpCli1.AuthSync;
   if not Success then goto wehaveaproblem;

   emailstatus := 4;
   Success := SyncSmtpCli1.MailSync;
   if not Success then goto wehaveaproblem;

   emailstatus := 5;
   Success := SyncSmtpCli1.QuitSync;
   if not Success then goto wehaveaproblem;




Async smtp sample: see ICS sample OverbyteIcsMailSndAsync.dproj.

Best regards
Michael




- Original Message - 
From: IMAGE cont...@image-zafar.com

To: twsocket@lists.elists.org
Sent: Wednesday, April 16, 2014 8:40 AM
Subject: [twsocket] Error in Sending mail



Hello,



After following an advise on a C++ forum (I use Builder C++), I download
ICS.



In first, I try to use the example IcsMailSnd.dproj



I enter my username and password, in SmtpCli (I don't need SSL).



When I launch the program, I enter the name of my Smtp server, the port
(587), my mail address in From, and an address in To .



I think it connected to the server, because I don't have any error 
message,

the From is OK, but I have an error message for Receipt (I try few address
of different domains, and it's the same message) : This domain isn't in 
our

allowed list.



I contact our webmaster, we verify with WireShark, and our webmaster tell 
me

that there isn't any authentification, but I have put the values
SmtpAuthlogin, or SmtpAuthPlain on propriety AuthType of SmtpCli 



May you advise me to solve this problem ?



Very cordially.

PL



--
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] Multiple TCp clients

2014-02-26 Thread Michael Gasser



Hi Noam

...definitely no need to synchronize in a single threaded app.

Multi threaded:
Main thread: Just add content to TMemo
Other threads: Use synchronize (Executes a method call within the main 
thread)

http://docwiki.embarcadero.com/Libraries/XE2/en/System.Classes.TThread.Synchronize

Regards
Michael

- Original Message - 
From: Noam weissman n...@silrd.com

To: ICS support mailing twsocket@lists.elists.org
Sent: Wednesday, February 26, 2014 9:49 AM
Subject: Re: [twsocket] Multiple TCp clients


Hi,

OK...

Make sense but if you have a few TWSocets running at the same time
and from every connection writing to a shared TMemo you do not
need to synchronize it somehow ?

OK, maybe my problem was different.

Thanks for elaborating this.

BR,
Noam.



-Original Message-
From: TWSocket on behalf of François Piette
Sent: Tue 2/25/2014 10:41 PM
To: 'ICS support mailing'
Subject: Re: [twsocket] Multiple TCp clients


Can you please explain there is definitely no such issue ?
I had a problem similar to this:
I had a thread sending ping's to a list of IP's to check if devices are

online.

Please read again what I said: His program isn't multithreaded.

If you use threads, then you can NOT acces any GUI item - such as a TMemo -
from your thread. VCL is not thread safe.


I was told by a friend that the reason for that happening is that window

is not an RT OS and will time slice the operation.

This is not related at all to a real time operating system or not.


Am I missing here something ?


I don't know. Maybe you forgot that TWSocket component multitask without
using threads. It simply uses events. And as such don't need to use
synchronization objects. Of course if you use TWSocket in a thread, you are
back to the difficulties of multithreading. And you may actually built a
slower application to make a long story short.

--
francois.pie...@overbyte.be
Embarcadero MVP
http://www.overbyte.be
http://francois-piette.blogspot.com






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




This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals  computer 
viruses.










This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals  computer 
viruses.





--
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] Multiple TCp clients

2014-02-26 Thread Michael Gasser


Hi Lusty

use f.e. wireshark ( http://www.wireshark.org/ ) to capture all packets 
sent to and received from your machines.


Then you'll know if the 7 sec delay is a problem caused by your machines or 
by your code ;-).


Regards
Michael


- Original Message - 
From: Christopher Lusty lu...@hinterland.ca

To: ICS support mailing twsocket@lists.elists.org
Sent: Wednesday, February 26, 2014 1:53 PM
Subject: Re: [twsocket] Multiple TCp clients



Sorry about the incomplete explanation.

It turns out that I had made an error and I was not allowing devices to 
respond every time before attempting to switch to another device - problem 
solved


It turns out that instrument response (every command is echoed back from 
the instrument along with status information) to a command is sometimes 
slow (up to 7 seconds) when I switch between instruments but this could 
well be an instrument issue - for that, I have to visit with the 
manufacturer, they have more sophisticated testing equipment.


Many thanks to all for the help.

Lusty

-Original Message- 
From: François Piette

Sent: Tuesday, February 25, 2014 1:52 PM
To: 'ICS support mailing'
Subject: Re: [twsocket] Multiple TCp clients

By 'bogged down' I mean that I can send and receive, alternating 
instruments but eventually

the instruments (or the software) stop working correctly


You have to better described stop working correctly if you want to 
significant help. What happens (or doesn't)? Is there any error code or 
exception? Put breakpoint, add display messages and all kind of debugging 
stuff.



Do you have a postcard from Orillia, Ontario, Canada yet?


Honestly, I can't tell you: I have received more than 4000 postcards for 
ICS registration. Send yours :-)


--
francois.pie...@overbyte.be
Embarcadero MVP
http://www.overbyte.be
http://francois-piette.blogspot.com






-Message d'origine-
De : TWSocket [mailto:twsocket-boun...@lists.elists.org] De la part de 
Christopher Lusty

Envoyé : mardi 25 février 2014 19:27
À : ICS support mailing
Objet : Re: [twsocket] Multiple TCp clients

Thank you Francois,

I was considering trying the array but wasn't sure that it would improve 
my results - having a single event handler is an excellent idea.


By 'bogged down' I mean that I can send and receive, alternating 
instruments but eventually the instruments (or the software) stop working 
correctly - my guess is that using only one OndataReceive event will so a 
long way to resolving this


Do you have a postcard from Orillia, Ontario, Canada yet?

Regards

Lusty

-Original Message-
From: François Piette
Sent: Tuesday, February 25, 2014 1:07 PM
To: 'ICS support mailing'
Subject: Re: [twsocket] Multiple TCp clients

Hello Chris,

Don't use TWSocketServer.

You should create an array (or a list or any collection you like) or 
TWSocket components. Then connect each TWSocket to his own instrument. You 
may use the same event handlers for all the TWSocket, simply use the 
Sender argument in each event to now who is who. All the sockets will work 
in parallel without any problem, without using thread and without 
requiring any synchronization with GUI components.



If I leave both instruments connected the system runs for a bit but
eventually gets bogged down.


Not sure by what you mean by bogged down. Ru your app under the debugger 
and report any exception. Also use madExcept to catch many errors with 
memory allocation and things like using freed objects and so on.


--
francois.pie...@overbyte.be
Embarcadero MVP
http://www.overbyte.be
http://francois-piette.blogspot.com





-Message d'origine-
De : TWSocket [mailto:twsocket-boun...@lists.elists.org] De la part de
Christopher Lusty
Envoyé : lundi 24 février 2014 22:38
À : twsocket@lists.elists.org
Objet : [twsocket] Multiple TCp clients

Hello all,

I am trying to interface with some laboratory instruments, previously we
used RS-232, now we are working on the next generation of machines

The instruments act as servers, I have established reliable communications
with each of the instruments as individual units using WSocket as a 
client.

Now, I would like to set it up such that I can talk to each instrument in
turn (it is never necessary to talk to more than one machine at a time).

As an experiment I have built a small app with two TWServers on board, 
each
is connected to buttons to dis/connect, send the contents of an edit box 
and
place the results in a memo. Each client represents a different 
instrument.


The setup works reasonably well if I connect-send-disconnect each 
instrument
in turn. If I leave both instruments connected the system runs for a bit 
but
eventually gets bogged down. I have no problem with having to make and 
break
when I switch machines except for the fact that sometimes the reconnect 
can

take a few seconds which, of course, slows things.

Any suggestions for this TCP newbie as to how to use multiple clients 
within

one piece of software 

Re: [twsocket] TWSocket Digest, Vol 554, Issue 3

2014-01-30 Thread Michael Gasser


Hi Noam

I think you should set breakpoints directly in the socket component (or even 
add some test code) to (maybe ;-)) see what happens.


Define a global flag F: boolean

In your code:
Before you assign values to ip and port
1. set F to true.
2. set a tag number for your socket, f.e. yoursocket.tag = 1234

Before you call connect
1. reset the F to false.

In the Socket component:
Wherever the ip or port are set to '' set a breakpoint with condition 
(F=true) AND (tag=1234).




Best regards
Michael




Message: 1
Date: Tue, 28 Jan 2014 23:17:43 +0200
From: Noam weissman n...@silrd.com
To: ICS support mailing twsocket@lists.elists.org
Subject: Re: [twsocket] TWSocket strange problem
Message-ID:
e44d48019612554d82017d1e60a164d502777...@sil-exchange.silora.co.il
Content-Type: text/plain; charset=ISO-8859-1

Hi,


Yes I run a few examples before using the components.

My current application has actually a few sockets.

I have a ping component checking if devices are online/offline. This is in 
its

own thread.

I have two sockets one for sending and one for receiving working in a 
separate

module with their own thread.

The socket that I have problems with is running in a separate thread

I added a testing code after assigning the Port and Addr, Something like 
this:


if((Socket-Addr == NULL) || (Socket-Port == 0))
{

And that was before even calling Connect...

Once in a few run's I got one of the above 0 or even both ?

I am sure that I am writing the port and IP values.

BR,
noam.



--
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] RFC 822 Date Time Conversion

2014-01-30 Thread Michael Gasser



Hi Richard


maybe you should check the user made component LASTMOD.ZIP from
http://www.overbyte.be/frame_index.html?redirTo=/products/usermade.html

___

I use this code in two programs.

My programs did send me some error feedback while parsing 'LAST-MODIFIED:'
(html downloads with ICS HttpCli) with the inet component above (5 errors, 
~500'000 downloads).


Therefore I had to slightly modify the code:
Two modifications - see 1., 3.
___
1.
Right after begin add:
INetDate := trim( INetDate );

(2.)
If you use XEn:
if Uppercase(MonthName) = string(Months[IX]) then
instead of
if Uppercase(MonthName) = Months[IX] then

3.
after line
Delete(InetDate,1,Pos(' ',InetDate));
add this line:
if pos( ' ', inetdate ) = 0 then inetdate := inetdate + ' ';
___


If you  f.e. want to catch the value of LAST-MODIFIED of a html file using a 
THttpCli :


modify : event httpgetHeaderEnd


procedure TsjOnlineForm.httpgetHeaderEnd(Sender: TObject);
VAR
 IX : INteger;
 hst, ST : STring;
 szgmt, DT : tDateTime;

try
 for IX := 0 to Httpget.RcvdHeader.count-1 do
   BEGIN
 hst := Httpget.RcvdHeader.Strings[IX];

 if Pos('Content-Length:',hst)  0 then
   BEGIN
 ST := hst;
 Delete(ST,1,Pos(' ',ST));
   END
  else
   if Pos('LAST-MODIFIED:',Uppercase(hst))  0 then
   BEGIN
 ST := hst;
 Delete(ST,1,Pos(':',ST));
 DT.:= 0;
try
 DT := InetStdDateToDateTime(ST);
except
  senderrorFeedback_eMail_to_RichardGallois( 'cannot parse t=' 
+ ST );

   end,
___


Best regards
Michael


- Original Message - 
From: Richard Gallois g...@llois.com

To: twsoc...@elists.org
Sent: Thursday, January 30, 2014 1:29 PM
Subject: [twsocket] RFC 822 Date Time Conversion



Hi,

Has anyone got a solid method of converting RFC 822 date times (e.g. Thu,
30 Jan 2014 05:48:07 +0800) to a TDateTime. I've found a function in Indy
to do this, but I'd rather not compile Indy into my project if there is an
ICS way to do this.

Many thanks,

Richard
--
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] unit OverbyteIcsWSocket.pas, version 8.06 -

2013-12-25 Thread Michael Gasser



Hi François

Merry Christmas to you, your family and all the ones you love.



Thank you for your answer about the range check error that occurs

in your unit OverbyteIcsWSocket.pas (version 8.06), function 
TCustomWSocket.Send
at line PostMessage(Handle, FMsg_WM_ASYNCSELECT, FHSocket, 
IcsMakeLong(FD_WRITE, 0)); [resaon FHSocket=-1].



I totally agree with you, every range check error is something to avoid ;-).
(As this one happens in your code, I thought you might be interested in.)


For me it works with adding

if FHSocket  -1 then
PostMessage...

to your code.



You might as well type cast (your answer, dec 22 2013) FHSocket - WParam( 
FHSocket ). Then no range check error occurs. But then you just send a 
FMsg_WM_ASYNCSELECT which will be handled in your


procedure TCustomWSocket.WMASyncSelect(var msg: TMessage);

by

  if msg.wParam  WPARAM(FHSocket) then
   Exit;


I prefer not to send PostMessage to the message queue.



Thank  you a lot for ICS.


Best regards
Michael





--

Message: 2
Date: Sun, 22 Dec 2013 16:55:38 +0100
From: Fran?ois Piette francois.pie...@skynet.be
To: 'ICS support mailing' twsocket@lists.elists.org
Subject: Re: [twsocket] unit OverbyteIcsWSocket.pas, version 8.06 -
range check error
Message-ID: 00e201ceff2e$43e6a2d0$cbb3e870$@skynet.be
Content-Type: text/plain; charset=iso-8859-1


When I send data using the send method, XE5 sometimes reports a

RangeCheckError

in function TCustomWSocket.Send(Data : TWSocketData; Len : Integer) :

Integer;

at line
 PostMessage(Handle,
   FMsg_WM_ASYNCSELECT,
   FHSocket,
   IcsMakeLong(FD_WRITE, 0));

Reason: FHSocket is -1

Maybe it's  by design (?). If you need  further infos then please let me

know.

FHSocket is -1 when the socket has been closed. This is not an issue but 
to

avoid the error, FHSocket should be cast to WParam like this:

 PostMessage(Handle,
   FMsg_WM_ASYNCSELECT,
   WParam(FHSocket),
   IcsMakeLong(FD_WRITE, 0));

Let me know if it works for you.

--
francois.pie...@overbyte.be
Embarcadero MVP
http://www.overbyte.be
http://francois-piette.blogspot.com






--
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] unit OverbyteIcsWSocket.pas, version 8.06 - range check error

2013-11-12 Thread Michael Gasser


twsocket@lists.elists.org twsocket@lists.elists.org




ICS 8
unit OverbyteIcsWSocket.pas, version 8.06
OS Windows 8.1
Delphi XE5
Target Platform Win32





Hi

I still think  that there is an error in
function TCustomWSocket.Send(Data : TWSocketData; Len : Integer) : Integer;
...as there were no answers to my post,  I am  probably the only one :-) (?) 
or I do miss a  thing...



Today, I have logged several range check errors in this function - all are 
of the same type:


Entering TCustomWSocket.Send

the values of FState and FHSocket are :
FState = wsConnected  FHSocket = Handle  -1

After
TryToSend;

the values are:
FState = wsClosed, FHSocket = -1, bAllSent = true

Given these values = range check error in function function 
TCustomWSocket.Send at line:
PostMessage(Handle, FMsg_WM_ASYNCSELECT, FHSocket, IcsMakeLong(FD_WRITE, 
0));

reason FHSocket  = -1.



What happens in TryToSend ?

if Count = SOCKET_ERROR then begin
   LastError := WSocket_Synchronized_WSAGetLastError;

value of count:
Count = -1 (SOCKET_ERROR)
LastError = 10057 (WSAENOTCONN)
=
Close;

= FHSocket = -1 FState = wsClosed



I think you should either
- set (in this case) bAllSent to false or
- only post the message (PostMessage(Handle, FMsg_WM_ASYNCSELECT, FHSocket, 
IcsMakeLong(FD_WRITE, 0));) if FHSocket  -1.





Regards
Michael


--
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] unit OverbyteIcsWSocket.pas, version 8.06 - range check error

2013-11-07 Thread Michael Gasser

twsocket@lists.elists.org twsocket@lists.elists.org


ICS 8
unit OverbyteIcsWSocket.pas, version 8.06
OS Windows 8.1
Delphi XE5
Target Platform Win32


Hi,

When I send data using the send method, XE5 sometimes reports a 
RangeCheckError
in function TCustomWSocket.Send(Data : TWSocketData; Len : Integer) : 
Integer;


at line

   PostMessage(Handle,
   FMsg_WM_ASYNCSELECT,
   FHSocket,
   IcsMakeLong(FD_WRITE, 0));

Reason: FHSocket is -1


Maybe it's  by design (?). If you need  further infos then please let me 
know.



Best regards
Michael


unit OverbyteIcsWSocket.pas, version 8.06 :

function TCustomWSocket.Send(Data : TWSocketData; Len : Integer) : Integer;
begin
   if (FState  wsConnected) and (FState  wsSocksConnected) then begin
   WSocket_Synchronized_WSASetLastError(WSAENOTCONN);
   SocketError('Send');
   Result := -1;
   Exit;
   end;

   bAllSent := FALSE;
   if Len = 0 then
   Result := 0
   else begin
   Result   := Len;
   PutDataInSendBuffer(Data, Len);
   end;

   if bAllSent then
   Exit;

   TryToSend;

   if bAllSent then begin
   { We post a message to fire the FD_WRITE message which in turn will}
   { fire the OnDataSent event. We cannot fire the event ourself  }
   { because the event handler will eventually call send again.   }
   { Sending the message prevent recursive call and stack overflow.   }
   { The PostMessage function posts (places) a message in a window's  }
   { message queue and then returns without waiting for the   }
   { corresponding window to process the message. The message will be }
   { seen and routed by Delphi a litle later, when we will be out of  }
   { the send function.   }
   PostMessage(Handle,
   FMsg_WM_ASYNCSELECT,
   FHSocket,
   IcsMakeLong(FD_WRITE, 0));
   end;
end; 


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be