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


Re: [twsocket] UDP Problem

2013-01-07 Thread Arno Garrels
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


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


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


Re: [twsocket] UDP and TCP on same socket - problem on WS2008 and W7

2012-07-24 Thread Stephen Dickason
 On starting on either a Windows Server 2008 R2 Standard or Windows
 7 machine, it comes up with an error message: Address not available
 (#10049 in setsockopt(IP_ADD_MEMBERSHIP)).

MSDN says: 

IP_ADD_MEMBERSHIP - WSAEADDRNOTAVAIL - Do not call IP_ADD_MEMBERSHIP with
the same group more than once on the same network interface.

so maybe you can not multicast on UDP and TCP at the same time on the same IP.

Seems if I set Multicast and ReuseAddr to false, it works fine.

--
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 and TCP on same socket - problem on WS2008 and W7

2012-07-23 Thread Stephen Dickason
 On starting on either a Windows Server 2008 R2 Standard or Windows
 7 machine, it comes up with an error message: Address not available
 (#10049 in setsockopt(IP_ADD_MEMBERSHIP)).

MSDN says: 

IP_ADD_MEMBERSHIP - WSAEADDRNOTAVAIL - Do not call IP_ADD_MEMBERSHIP with
the same group more than once on the same network interface.

so maybe you can not multicast on UDP and TCP at the same time on the same IP.

In netstat -a output I am observing to the contrary for another program that 
does this successfully on all 3 versions of Windows.  (Aniazpopup - free off 
internet).
The one difference I can see between my program and others is the local port is 
set to 0.0.0.0 instead of the machine's IP address.

I've looked at that MSDN page previously and not sure what it means by same 
group.  Doesn't seem to mean same port.

I would think I'm not actually multicasting on the TCP server socket though - 
didn't think that was possible, hence the UDP usage.

Would this have any link to IPv6 changes?  My XP box is still pre-IPv6.

Stephen

--
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 and TCP on same socket - problem on WS2008 and W7

2012-07-20 Thread Angus Robertson - Magenta Systems Ltd
 On starting on either a Windows Server 2008 R2 Standard or Windows 
 7 machine, it comes up with an error message: Address not available 
 (#10049 in setsockopt(IP_ADD_MEMBERSHIP)).

MSDN says: 

IP_ADD_MEMBERSHIP - WSAEADDRNOTAVAIL -  Do not call IP_ADD_MEMBERSHIP with
the same group more than once on the same network interface.

so maybe you can not multicast on UDP and TCP at the same time on the
same IP.

Angus

--
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 server and network configuration changes

2012-02-06 Thread Arno Garrels
Emanuele Bizzarri wrote:
 Hi Francois,
 thank you for your response.
 In the meanwhile, I also have found NotifyAddrChange function.
 It is already wrapped inside JwaIpHlpApi by jedi project.
 
 For now I'm using network interface polling.

Check out the IPv6 branch, SVN rev. #888, since ICS IPv6 uses winsock2 these
new events could be added:
IPv6 TWSocket Windows - Added events OnAddressListChanged and 
OnRoutingInterfaceChanged.
Assigning event handlers to those properties before a call to methods Connect 
or Listen ensures that the event notifications are registered and events are 
triggered when they occur.
Assigning handlers to those properties after Connect or Listen (if new 
ComponentOptions wsoNotifyAddressListChange or wsoNotifyRoutingInterfaceChange 
are _not set) requires an additional call to new methods 
SetAddressListChangeNotification and/or SetRoutingInterfaceChangeNotification 
in order to receive those notifications. 
Note that once one of these events triggered it has to be re-enabled, they are 
edge-triggered. 

svn://svn.overbyte.be/ics/branches/icsipv6
Use username = ics and password = ics for read access

-- 
Arno Garrels

 
 Bye
 
 
 
 - Messaggio originale -
 Da: François Piette francois.pie...@skynet.be
 A: ICS support mailing twsocket@elists.org
 Inviato: Venerdì, 3 febbraio 2012 18:37:02
 Oggetto: Re: [twsocket] udp server and network configuration changes
 
 There is a way to recognize networks changes like these?
 
 Have a look at IP Helper API:
 http://msdn.microsoft.com/en-us/library/aa366329(VS.85).aspx
 
 
 --
 francois.pie...@overbyte.be
 The author of the freeware multi-tier middleware MidWare
 The author of the freeware Internet Component Suite (ICS)
 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
--
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 server and network configuration changes

2012-02-06 Thread Emanuele Bizzarri
Hi Arno,
I'll try it as soon as possible.

Thank you,
Bye

- Messaggio originale -
Da: Arno Garrels arno.garr...@gmx.de
A: ICS support mailing twsocket@elists.org
Inviato: Lunedì, 6 febbraio 2012 9:05:52
Oggetto: Re: [twsocket] udp server and network configuration changes

Emanuele Bizzarri wrote:
 Hi Francois,
 thank you for your response.
 In the meanwhile, I also have found NotifyAddrChange function.
 It is already wrapped inside JwaIpHlpApi by jedi project.
 
 For now I'm using network interface polling.

Check out the IPv6 branch, SVN rev. #888, since ICS IPv6 uses winsock2 these
new events could be added:
IPv6 TWSocket Windows - Added events OnAddressListChanged and 
OnRoutingInterfaceChanged.
Assigning event handlers to those properties before a call to methods Connect 
or Listen ensures that the event notifications are registered and events are 
triggered when they occur.
Assigning handlers to those properties after Connect or Listen (if new 
ComponentOptions wsoNotifyAddressListChange or wsoNotifyRoutingInterfaceChange 
are _not set) requires an additional call to new methods 
SetAddressListChangeNotification and/or SetRoutingInterfaceChangeNotification 
in order to receive those notifications. 
Note that once one of these events triggered it has to be re-enabled, they are 
edge-triggered. 

svn://svn.overbyte.be/ics/branches/icsipv6
Use username = ics and password = ics for read access

-- 
Arno Garrels

 
 Bye
 
 
 
 - Messaggio originale -
 Da: François Piette francois.pie...@skynet.be
 A: ICS support mailing twsocket@elists.org
 Inviato: Venerdì, 3 febbraio 2012 18:37:02
 Oggetto: Re: [twsocket] udp server and network configuration changes
 
 There is a way to recognize networks changes like these?
 
 Have a look at IP Helper API:
 http://msdn.microsoft.com/en-us/library/aa366329(VS.85).aspx
 
 
 --
 francois.pie...@overbyte.be
 The author of the freeware multi-tier middleware MidWare
 The author of the freeware Internet Component Suite (ICS)
 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
--
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 server and network configuration changes

2012-02-05 Thread Emanuele Bizzarri
Hi Francois,
thank you for your response.
In the meanwhile, I also have found NotifyAddrChange function.
It is already wrapped inside JwaIpHlpApi by jedi project.

For now I'm using network interface polling.

Bye



- Messaggio originale -
Da: François Piette francois.pie...@skynet.be
A: ICS support mailing twsocket@elists.org
Inviato: Venerdì, 3 febbraio 2012 18:37:02
Oggetto: Re: [twsocket] udp server and network configuration changes

 There is a way to recognize networks changes like these? 

Have a look at IP Helper API:
http://msdn.microsoft.com/en-us/library/aa366329(VS.85).aspx


--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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

--
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 server and network configuration changes

2012-02-03 Thread François Piette
 There is a way to recognize networks changes like these? 

Have a look at IP Helper API:
http://msdn.microsoft.com/en-us/library/aa366329(VS.85).aspx


--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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 receive issue from a Windows service

2011-04-20 Thread Éric Fleming Bonilha

François

This could sound silly.. but is your Firewall active?

We have a service application that receives UDP packets and we only have 
issues when windows firewall is active


Eric

-Mensagem Original- 
From: Francois PIETTE

Sent: Monday, April 18, 2011 4:47 AM
To: twsocket@elists.org
Subject: [twsocket] UDP receive issue from a Windows service

Hi !

I have a strange problem: in a windows service and using UDP, the service do
not receive UDP datagram. Trying to debug this problem, I attach Delphi
debugger to the running service and suddenly it starts receiving the UDP
datagrams !

Actually the service is a dual mode service/app console and it works
perfectly well as a console application (and also as a service when a
debugger is attached).

Any idea bout what could be wrong ? Probably a permission issue. It makes
use of the default local system account used for services. Tested on Vista
Ultimate 32 bits.

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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 


--
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 receive issue from a Windows service

2011-04-19 Thread Arno Garrels
Francois PIETTE wrote:
 GDisplayProc is assigned a routine which output the message to the
 console window and to the log file and which is used all over the
 application. 
 
 Guess what ? It works !
 This is not satisfying since the log file is full of unwanted
 messages and this probably only hides the real problem.

Does that mean notification from winsock works however the call to 
ReceiveFrom fails or doesn't return data?

Or does it receive data with this extra logging?

-- 
Arno Garrels

--
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 receive issue from a Windows service

2011-04-19 Thread Dave Baxter
Surely, an attached debugger is going to use some CPU time, however
small even if nothing triggers it, therefore, the debugged program cycle
timing will change somehow, however small.

Plus, however the debugger works, it could be forcing some other process
(in the kernel) to do it's job more often, so keeping something
up-to-date, that might otherwise slip a bit without that constant
poking.

I've also seen similar things (with other high speed I/O) in the past,
it's 99% of the time, a timing problem.  Somethings on the ragged edge,
and any attached process (Debugger or ???) just helps that little bit by
sneeking in a few extra nS somewhere. Multi core CPU's or
HyperThreading seem to provoke this sort of mayhem more than most..
Can you dedicate your program to one core, and one core only?

You did say TCP works OK, the extra overhead of that stack probably
add's some time, and/or forces some data table updating, helping things
too.

Remember, Windows is not a real time system.  Plus, it's not entirely
unknown for MS to do things in not quite the right way.  (As the rest of
the world sees it anyway...)

It could of course, be something completely different, to quote Monty
Python...

I'll get me coat..

Dave B.


 -Original Message-
 From: Francois PIETTE [mailto:francois.pie...@skynet.be] 
 
  I think that if you consider what I suggested before, might 
 help you...
  It maybe has to do with extra process time the debugger gives
 
 Thanks for insisting.
 
 Which extra process time do you mean ? The debugger has just 
 to be attached. 
 No need to set any breakpoint nor single step. Just attach. 
 IMO, when a debugger is attached, the process is not slowed down.
 
 I would also add that there is definetely no CPU time issue, 
 nor network I/O issue with the application. Every second, it 
 send a single UDP datagram (A SNMP get request) and expect a 
 single UDP datagram (A SNMP get reply). A single socket is 
 used for both send and receive and datagram fits in winsock 
 receive buffer.
 
 -- 
 francois.pie...@overbyte.be
 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 receive issue from a Windows service

2011-04-19 Thread Francois PIETTE

GDisplayProc is assigned a routine which output the message to the
console window and to the log file and which is used all over the
application.

Guess what ? It works !
This is not satisfying since the log file is full of unwanted
messages and this probably only hides the real problem.


Does that mean notification from winsock works however the call to
ReceiveFrom fails or doesn't return data?

Or does it receive data with this extra logging?


It receive data.
While testing, I also had during some time FD_READ triggered but ReceiveFrom 
returning -1.


--
francois.pie...@overbyte.be
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 receive issue from a Windows service

2011-04-19 Thread Arno Garrels
Francois PIETTE wrote:
 GDisplayProc is assigned a routine which output the message to the
 console window and to the log file and which is used all over the
 application.
 
 Guess what ? It works !
 This is not satisfying since the log file is full of unwanted
 messages and this probably only hides the real problem.
 
 Does that mean notification from winsock works however the call to
 ReceiveFrom fails or doesn't return data?
 
 Or does it receive data with this extra logging?
 
 It receive data.

Then I would search for a bug in the service/thread code.

 While testing, I also had during some time FD_READ triggered but
 ReceiveFrom returning -1.

Isn't that quite common, if those are WSAEWOULDBLOCK errors?

-- 
Arno Garrels

--
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 receive issue from a Windows service

2011-04-19 Thread Francois PIETTE

While testing, I also had during some time FD_READ triggered but
ReceiveFrom returning -1.


Isn't that quite common, if those are WSAEWOULDBLOCK errors?


As far as I know, not so much. I saw is returning -1 during 4 seconds which 
is the timeout time in my appication.


--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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 receive issue from a Windows service

2011-04-18 Thread Arno Garrels
Hello Francois,

 Hi !
 
 I have a strange problem: in a windows service and using UDP, the
 service do not receive UDP datagram. Trying to debug this problem, I
 attach Delphi debugger to the running service and suddenly it starts
 receiving the UDP datagrams !
 
 Actually the service is a dual mode service/app console and it works
 perfectly well as a console application (and also as a service when a
 debugger is attached).
 
 Any idea bout what could be wrong ? Probably a permission issue. It
 makes use of the default local system account used for services.
 Tested on Vista Ultimate 32 bits.

No idea, but that can't be a permission issue IMO. Receiving datagrams
in a service running as system works fine. Also attaching a debugger 
doesn't change security context of the debugee.
What happens is that a new thread is created in the process being
debugged, maybe there's some issue with your multi-threading?

-- 
Arno 


 
 --
 francois.pie...@overbyte.be
 The author of the freeware multi-tier middleware MidWare
 The author of the freeware Internet Component Suite (ICS)
 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 receive issue from a Windows service

2011-04-18 Thread Francois PIETTE

No idea, but that can't be a permission issue IMO. Receiving datagrams
in a service running as system works fine. Also attaching a debugger
doesn't change security context of the debugee.
What happens is that a new thread is created in the process being
debugged, maybe there's some issue with your multi-threading?


Maybe, but then why attaching a debugger would make things suddently work ?
I really don't know what to do since attaching a debugger solve the issue. 
This really puzzles me !


The code for the service is the code I already used in other application 
which works fine (using TCP altough).


--
francois.pie...@overbyte.be
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 receive issue from a Windows service

2011-04-18 Thread Dimitris Botsis

On 18/4/2011 2:34 μμ, Francois PIETTE wrote:

No idea, but that can't be a permission issue IMO. Receiving datagrams
in a service running as system works fine. Also attaching a debugger
doesn't change security context of the debugee.
What happens is that a new thread is created in the process being
debugged, maybe there's some issue with your multi-threading?


Maybe, but then why attaching a debugger would make things suddently work ?
I really don't know what to do since attaching a debugger solve the
issue. This really puzzles me !

The code for the service is the code I already used in other application
which works fine (using TCP altough).



I had a similar experience in the past, not with ICS components but 
generally working on a completely different project.
When project was running normally at some point did not work but when 
attaching a debugger then it would work.
The problem at that situation was that the program needed some time to 
be given for some external operations, so if a debugger was attached or 
a sleep was introduced or a Application.Processmessages command was 
introduced, then it could work.
I don't know if this solves the issue at your situation, but maybe it 
helps. Good luck.

--
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 receive issue from a Windows service

2011-04-18 Thread Francois PIETTE
I had a similar experience in the past, not with ICS components but 
generally working on a completely different project.
When project was running normally at some point did not work but when 
attaching a debugger then it would work.
The problem at that situation was that the program needed some time to 
be given for some external operations, so if a debugger was attached or 
a sleep was introduced or a Application.Processmessages command was 
introduced, then it could work.
I don't know if this solves the issue at your situation, but maybe it 
helps. Good luck.


Thanks for suggestion, but I think this doesn't apply in my case.

--
francois.pie...@overbyte.be
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 receive issue from a Windows service

2011-04-18 Thread Angus Robertson - Magenta Systems Ltd
 *Subject:* Re: [twsocket] UDP receive issue from a Windows service
 The code for the service is the code I already used in other 
 application which works fine (using TCP altough).

I have UDP listen sockets in my ComCap application, running as a service,
sucking in syslogs on port 514 24/7 from my firewalls on three servers,
including 2008 which is the same as Vista.  

I have seen problems sending UDP, probably using a fixed port which I do
sometimes to identify multiple UDP streams from the same server, but am
planning on trying the ReuseAddr feature. 

Angus

--
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 receive issue from a Windows service

2011-04-18 Thread Maurizio Lotauro
Maybe when you use the debugger then the application run undeer a different 
user?

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://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] UDP receive issue from a Windows service

2011-04-18 Thread Arno Garrels
Maurizio Lotauro wrote:
 Maybe when you use the debugger then the application run undeer a
 different user?

Not when the debugger is attached to a running process.
If the debugger spawns the process to be debugged with CreateProcess
then that might happen.

-- 
Arno Garrels 

--
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 receive issue from a Windows service

2011-04-18 Thread Dimitris Botsis

On 18/4/2011 5:12 μμ, Arno Garrels wrote:

Maurizio Lotauro wrote:

Maybe when you use the debugger then the application run undeer a
different user?


Not when the debugger is attached to a running process.
If the debugger spawns the process to be debugged with CreateProcess
then that might happen.


I think that if you consider what I suggested before, might help you...
It maybe has to do with extra process time the debugger gives
--
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 receive issue from a Windows service

2011-04-18 Thread Francois PIETTE

Maybe when you use the debugger then the application run
undeer a different user?


I start the service which starts sending his UDP datagrams (This is a SNMP 
client) and waiting for UDP response which never comes. Then I attach the 
debugger to the running service process and suddenly the UDP datagrams are 
coming in.



--
francois.pie...@overbyte.be
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 receive issue from a Windows service

2011-04-18 Thread Francois PIETTE

I think that if you consider what I suggested before, might help you...
It maybe has to do with extra process time the debugger gives


Thanks for insisting.

Which extra process time do you mean ? The debugger has just to be attached. 
No need to set any breakpoint nor single step. Just attach. IMO, when a 
debugger is attached, the process is not slowed down.


I would also add that there is definetely no CPU time issue, nor network I/O 
issue with the application. Every second, it send a single UDP datagram (A 
SNMP get request) and expect a single UDP datagram (A SNMP get reply). A 
single socket is used for both send and receive and datagram fits in winsock 
receive buffer.


--
francois.pie...@overbyte.be
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 receive issue from a Windows service

2011-04-18 Thread Dimitris Botsis

On 18/4/2011 5:35 μμ, Francois PIETTE wrote:

I think that if you consider what I suggested before, might help you...
It maybe has to do with extra process time the debugger gives


Thanks for insisting.

Which extra process time do you mean ? The debugger has just to be
attached. No need to set any breakpoint nor single step. Just attach.
IMO, when a debugger is attached, the process is not slowed down.

I would also add that there is definetely no CPU time issue, nor network
I/O issue with the application. Every second, it send a single UDP
datagram (A SNMP get request) and expect a single UDP datagram (A SNMP
get reply). A single socket is used for both send and receive and
datagram fits in winsock receive buffer.

When the debugger is attached is it exactly the same like when it's not 
attached for the program being executed ?

OK then, my idea was that it's different.
Actually I work with some external hardware devices (USB / serial 
connected) that sometimes in the past performed like in the reported 
problem and the solution was to give some more available time to the 
program with Application.ProcessMessages. But when the debugger was 
attached, this solution was not needed and it always worked fine.
Anyway, my approach for the specific problem reported is more generic, 
not dealing at winsock level.

--
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 receive issue from a Windows service

2011-04-18 Thread Francois PIETTE
When the debugger is attached is it exactly the same like when it's not 
attached for the program being executed ?


I would say no since my application is working.
But I would say it doesn't change the time required to do domething.


OK then, my idea was that it's different.
Actually I work with some external hardware devices (USB / serial 
connected) that sometimes in the past performed like in the reported 
problem and the solution was to give some more available time to the 
program with Application.ProcessMessages. But when the debugger was 
attached, this solution was not needed and it always worked fine.
Anyway, my approach for the specific problem reported is more generic, 
not dealing at winsock level.


OK, thanks anyway.

--
francois.pie...@overbyte.be
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 receive issue from a Windows service

2011-04-18 Thread Arno Garrels
Francois PIETTE wrote:
 Maybe when you use the debugger then the application run
 undeer a different user?
 
 I start the service which starts sending his UDP datagrams (This is a
 SNMP client) and waiting for UDP response which never comes. Then I
 attach the debugger to the running service process and suddenly the
 UDP datagrams are coming in.

Sounds like a Microsoft innovation preventing too many bug reports ;)

-- 
Arno Garrels 


--
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 receive issue from a Windows service

2011-04-18 Thread Arno Garrels
Arno Garrels wrote:
 Francois PIETTE wrote:
 Maybe when you use the debugger then the application run
 undeer a different user?
 
 I start the service which starts sending his UDP datagrams (This is a
 SNMP client) and waiting for UDP response which never comes. Then I
 attach the debugger to the running service process and suddenly the
 UDP datagrams are coming in.
 
 Sounds like a Microsoft innovation preventing too many bug reports ;)

Seriously, what happens if you run the console application as a 
service with my NT Wrapper http://www.duodata.de/ntwrapper/?
If that works I guess the problem can be found in your service code,
assuming that you neither use the Delphi service framework nor
my DDService (http://www.duodata.de/misc/delphi/DDService.zip).

--
Arno Garrels


--
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 receive issue from a Windows service

2011-04-18 Thread Wilfried Mestdagh
Hi Francois,

 Actually the service is a dual mode service/app console and it works
 perfectly well as a console application (and also as a service when a
 debugger is attached).

I do not understand the 'dual mode' but could that be a reason? What happens
if you put your application into 1 object (no console interaction), then
create/run it in a console application then create/run it in a NT service
application?

-- 
mvg, Wilfried
http://www.mestdagh.biz
http://www.comfortsoftware.be
http://www.expertsoftware.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 receive issue from a Windows service

2011-04-18 Thread Francois PIETTE

Actually the service is a dual mode service/app console and it works
perfectly well as a console application (and also as a service when a
debugger is attached).



I do not understand the 'dual mode' but could that be a reason?


A dual mode service is an application which detect if it run as a service 
application or as a normal console application and take appropriate action 
according to the context. This is very handy for debugging.


What happens if you put your application into 1 object (no console 
interaction), then

create/run it in a console application then create/run it in a NT service
application?


This require a lot of work. I will do if I can't manage to make it work in 
dualmode.


--
francois.pie...@overbyte.be
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 receive issue from a Windows service

2011-04-18 Thread Wilfried Mestdagh
Hi Francois,

 A dual mode service is an application which detect if it run as a
 service

I understeand. I did the same concept years ago 

-- 
mvg, Wilfried
http://www.mestdagh.biz
http://www.comfortsoftware.be
http://www.expertsoftware.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 Receive problem

2011-04-15 Thread Éric Fleming Bonilha

HI François

Thanks for the advices

Having two separet thread is not enough. You have to closely look at how 
the receiving thread communicate with the processing/display thread. For 
example if you use synchronize, you actually defeat the multithreading. 
Same with SendMessage. You must keep the message pump of the receiver 
thread run at full speed.


I found the problem and I´m mad at my self!!

The problem is that I was not setting the receive buffer size... But I have 
programmed it.. only for Listening state, when the socket enters on listen 
state I set the receive buffer and it always worked because I usually only 
use UDP sockets to listen, but I was making a particular implementation that 
I had to send UDP data on the same socket, so I used Connect method instead 
of Listen, so, when socket changed state, it was not setting the receive 
buffer size because it was only programmed to set the size when socket was 
Listening!


Well...

Silly

Thanks a lot!
Eric 


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

2011-04-15 Thread Francois PIETTE

I'm happy you finally found the problem.
Thanks for your feeback.

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be


- Original Message - 
From: Éric Fleming Bonilha e...@digifort.com.br

To: ICS support mailing twsocket@elists.org
Sent: Saturday, April 16, 2011 1:01 AM
Subject: Re: [twsocket] UDP Receive problem


HI François

Thanks for the advices

Having two separet thread is not enough. You have to closely look at how 
the receiving thread communicate with the processing/display thread. For 
example if you use synchronize, you actually defeat the multithreading. 
Same with SendMessage. You must keep the message pump of the receiver 
thread run at full speed.


I found the problem and I´m mad at my self!!

The problem is that I was not setting the receive buffer size... But I have
programmed it.. only for Listening state, when the socket enters on listen
state I set the receive buffer and it always worked because I usually only
use UDP sockets to listen, but I was making a particular implementation that
I had to send UDP data on the same socket, so I used Connect method instead
of Listen, so, when socket changed state, it was not setting the receive
buffer size because it was only programmed to set the size when socket was
Listening!

Well...

Silly

Thanks a lot!
Eric

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

2011-04-14 Thread Éric Fleming Bonilha

HI François

I thought on processing speed, but I use a separated thread for I/O 
communication and for testing I have only 1 socket and still dropping some 
packets. And for testing, at a given time, the processor usage is always 0%. 
The received data is not even large, I can notice drops in receiving just 20 
packets of 1400 bytes of data. In any case, that would fit inside winsock 
buffer, even if my application is hang right?


I also increased the winsock receive buffer to 256KB. Is there a limit of 
winsock receive buffer?


Eric

-Mensagem Original- 
From: Francois PIETTE

Sent: Thursday, April 14, 2011 2:07 AM
To: ICS support mailing
Subject: Re: [twsocket] UDP Receive problem

My application receives UDP data from IP Cameras, somehow we are not 
receiving some
packets, but by using a network sniffer I can see that the packet was 
received, but the

application never receives it!
I already checked receive buffer lengths.. I actually spent 2 entire days 
cheking for

solutions but I couldn´t find anything


At first glance, I would say that your receiving application is not able to
receive the datagrams as fast as they are comming. So they are simply
dropped from winsock buffer as new datagrams are comming in.

I suggest you use a different thread for the newtork I/O (TWSocket) and for
the computation and display. Let's name the thread with TWSocket a worker
thread. The worker thread can be assigne high priority and build a large
buffer to store datagrams until the main thread is able to process it. Pay
attention to not use anything taking time ! Specially, do not use
Synchronize. Of course you need a critical section to have the main thread
and worker thread to acces the queue at the same time. Pay a lot of
attention to the duration of the lock, make it as small as possible or you
are back to your initial issue.

Also note that this design will potentially cause trouble if the overall
computation and display time is slower than the average network I/O speed,
the your buffer will grow. At some time you'll be forced to drop datagrams
yourself to avoid accumulating data.

Another possibility is that you have a bug in your application which makes
some datagrams unprocessed.
Yest another possibility is that you have a security product which is
bugged or takes too long to process. Many security product intercept the
network I/O to check for malware.


--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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 


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

2011-04-13 Thread Francois PIETTE
My application receives UDP data from IP Cameras, somehow we are not 
receiving some
packets, but by using a network sniffer I can see that the packet was 
received, but the

application never receives it!
I already checked receive buffer lengths.. I actually spent 2 entire days 
cheking for

solutions but I couldn´t find anything


At first glance, I would say that your receiving application is not able to 
receive the datagrams as fast as they are comming. So they are simply 
dropped from winsock buffer as new datagrams are comming in.


I suggest you use a different thread for the newtork I/O (TWSocket) and for 
the computation and display. Let's name the thread with TWSocket a worker 
thread. The worker thread can be assigne high priority and build a large 
buffer to store datagrams until the main thread is able to process it. Pay 
attention to not use anything taking time ! Specially, do not use 
Synchronize. Of course you need a critical section to have the main thread 
and worker thread to acces the queue at the same time. Pay a lot of 
attention to the duration of the lock, make it as small as possible or you 
are back to your initial issue.


Also note that this design will potentially cause trouble if the overall 
computation and display time is slower than the average network I/O speed, 
the your buffer will grow. At some time you'll be forced to drop datagrams 
yourself to avoid accumulating data.


Another possibility is that you have a bug in your application which makes 
some datagrams unprocessed.
Yest another possibility is that you have a security product which is 
bugged or takes too long to process. Many security product intercept the 
network I/O to check for malware.



--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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 packet loss

2011-03-01 Thread emanuele bizzarri
Hi Francois, hi all

 I cannot reproduce the packet loss on localhost.

Strange. I always lose some packets on localhost (at least setting
Interval=0 on the client).

 I can reproduce on different computers, but I found a flaw in your
 design: remember TWSocket use non blocking. SendTo will fail if winsock
 is not able to receive data and you don't check that condition.

Yes you're right. Now I've modified the code like this:

procedure TForm1.OnTimer(aSender:TObject);
begin
  if fWS.State=wsConnected then
  begin
move(fCounter,fData^,4);
if (fWS.SendTo(fPeerSrc,fPeerSrcLen,fData,fDataSize)0)or
   (WSocket_WSAGetLastError=WSAEWOULDBLOCK)
then
  inc(fSent);
  end;
end;

procedure TForm1.WSocketDataSent(Sender: TObject; ErrCode: Word);
begin
  if fSent0 then
  begin
dec(fSent);
inc(fCounter);
inc(fBR,fDataSize);
Restart;
  end;
end;

Is it right? This is like I do in my real application.

 I'm not sure you correctly checked with wireshark that all packets where
 sent actually because their aren't when SendTo fails.

I'm pretty sure yes.
I've set internal packet number equal to wireshark packet number. Inside
wireshark, if I select one lost packet by the server application, I can
see that internal packet number corresponds.
So I think that this client side bug is not the cause of packet loss.
However I've fixed it.

Yesterday I have done some tests. I've tried different computers.
I noticed that:
On localhost I can reach very different max bitrates. From about 90Mbps
under winXp (cpu=T2300@1.66GHz), until 250Mbps under win7
(cpu=I72630QM@2.00GHz), but always some packet are lost.

On different machines, connected with a cross cable and Gbps ethernet
cards (I've installed the udp server over Q9300 2,5GHz machine, using
different operating systems), max bitrate is always about 160Mbps but:
under winXp a lot of packets are lost.
under win7 less packets are lost than using winXp.
under ubuntu+wine less packets are lost than using winXp and about the
same as win7.

If I open wireshark many more packets are lost by the application (not
by wireshark).

I noticed that if I set:
SetPriorityClass (GetCurrentProcess, HIGH_PRIORITY_CLASS);
and
fUDPServer.Priority:=tpNormal

less packets are lost (no improvement if I set also
fUDPServer.Priority:=tpTimeCritical);

I've tried to compile a third party example of udp server that use
winsock in a different way:
http://www.tenouk.com/Winsock/Winsock2example9.html
under windows and under linux, but the results are like the same.

I've also tried Indy project, but no improvement has been obtained.


I don't know if my tests are completely correct, but
my conclusion is that the mechanism of messaging notification used by
windows can create a udp rx bottleneck in some circumstances (system
wide and not only application wide).

In my real application (where bitrates are two orders of magnitude
lower) I've create a thread pool to manage incoming and outcoming data.
Data are transferred by threads using async queues (that use win
messages) with skip data mechanism where possible.
The result is that, however, udp rx is very (too much) sensible to any
action done on the system.
Now I'm working to reduce this sensibility. I can accept any other kind
of compromise, but I'd like that if udp packets phisically arrive on the
machine they were not discarded.


 var
  lBuffer:array[0..1500] of AnsiChar;
 I'd advice you not to allocate static buffer inside a method because
it is placed inside the stack every time method is called.


yes you're right. In my real application buffers are statically allocated.
I'm going to modify also the example like you say.


Thankyou for help,
Emanuele
--
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 packet loss

2011-03-01 Thread Francois PIETTE

Is it right? This is like I do in my real application.


IMO it isn't. If sending full speed, forget the timer and only use the 
event.
When using the timer, check a flag you set in OnDataSent. if falg not set, 
do not send anything, just exit the timer event handler, data will be sent 
on next tick.



Yesterday I have done some tests. I've tried different computers.
I noticed that:
On localhost I can reach very different max bitrates. From about 90Mbps
under winXp (cpu=T2300@1.66GHz), until 250Mbps under win7
(cpu=I72630QM@2.00GHz), but always some packet are lost.


In my opinion, sending back to back UDP packet will almost always result in 
packet lost. This is because the thread receiving data could be suspended 
for at last 20 mS or even much much more (Windows is not a real time OS). 
Winsock buffer must be large enough to buffer all data while thread is 
suspended and even larger since it has to somehow empty the buffer (Remember 
UDP has no flow control). You can set winsock to use a larger buffer 
(default is 8KB is memory serve me well).



If I open wireshark many more packets are lost by the application
(not by wireshark).


Wireshark do not loose packet because it has a Windows Driver running in 
kernel mode and working using interrupt, packets are buffered in memory and 
that buffer is displayed by the GUI independently (just like you are 
browsing a database). Of course you can do that as well, but not with ICS 
which only works in usermode.


--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be



- Original Message - 
From: emanuele bizzarri e.bizza...@e-works.it

To: ICS support mailing twsocket@elists.org
Sent: Tuesday, March 01, 2011 10:11 AM
Subject: Re: [twsocket] udp packet loss



Hi Francois, hi all


I cannot reproduce the packet loss on localhost.


Strange. I always lose some packets on localhost (at least setting
Interval=0 on the client).


I can reproduce on different computers, but I found a flaw in your
design: remember TWSocket use non blocking. SendTo will fail if winsock
is not able to receive data and you don't check that condition.


Yes you're right. Now I've modified the code like this:

procedure TForm1.OnTimer(aSender:TObject);
begin
 if fWS.State=wsConnected then
 begin
   move(fCounter,fData^,4);
   if (fWS.SendTo(fPeerSrc,fPeerSrcLen,fData,fDataSize)0)or
  (WSocket_WSAGetLastError=WSAEWOULDBLOCK)
   then
 inc(fSent);
 end;
end;

procedure TForm1.WSocketDataSent(Sender: TObject; ErrCode: Word);
begin
 if fSent0 then
 begin
   dec(fSent);
   inc(fCounter);
   inc(fBR,fDataSize);
   Restart;
 end;
end;

Is it right? This is like I do in my real application.


I'm not sure you correctly checked with wireshark that all packets where
sent actually because their aren't when SendTo fails.


I'm pretty sure yes.
I've set internal packet number equal to wireshark packet number. Inside
wireshark, if I select one lost packet by the server application, I can
see that internal packet number corresponds.
So I think that this client side bug is not the cause of packet loss.
However I've fixed it.

Yesterday I have done some tests. I've tried different computers.
I noticed that:
On localhost I can reach very different max bitrates. From about 90Mbps
under winXp (cpu=T2300@1.66GHz), until 250Mbps under win7
(cpu=I72630QM@2.00GHz), but always some packet are lost.

On different machines, connected with a cross cable and Gbps ethernet
cards (I've installed the udp server over Q9300 2,5GHz machine, using
different operating systems), max bitrate is always about 160Mbps but:
under winXp a lot of packets are lost.
under win7 less packets are lost than using winXp.
under ubuntu+wine less packets are lost than using winXp and about the
same as win7.

If I open wireshark many more packets are lost by the application (not
by wireshark).

I noticed that if I set:
SetPriorityClass (GetCurrentProcess, HIGH_PRIORITY_CLASS);
and
fUDPServer.Priority:=tpNormal

less packets are lost (no improvement if I set also
fUDPServer.Priority:=tpTimeCritical);

I've tried to compile a third party example of udp server that use
winsock in a different way:
http://www.tenouk.com/Winsock/Winsock2example9.html
under windows and under linux, but the results are like the same.

I've also tried Indy project, but no improvement has been obtained.


I don't know if my tests are completely correct, but
my conclusion is that the mechanism of messaging notification used by
windows can create a udp rx bottleneck in some circumstances (system
wide and not only application wide).

In my real application (where bitrates are two orders of magnitude
lower) I've create a thread pool to manage incoming and outcoming data.
Data are transferred by threads using async queues (that use win
messages) with skip data mechanism where possible.
The result is that, however, udp rx is very (too much

Re: [twsocket] udp packet loss

2011-02-28 Thread Anton S.
var
  lBuffer:array[0..1500] of AnsiChar;
I'd advice you not to allocate static buffer inside a method because it is 
placed inside the stack every time method is called.

-- 
Anton
--
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 packet loss

2011-02-27 Thread emanuele bizzarri
Hi,

 I'll assume you use a direct cable or put wireshark at the receiving
 computer because sending a packet is not a problem. Having the packet
 reaching the network card of the receiving computer is a different thing
 if there is something in between.

Yes, I use a cross cable and two laptop with 1gbps ethernet cards
(CPU1=T8100@2.10GHz CPU2=T2300@1.66GHz).
I use wireshark on the udp server machine in this way:
1. Start wireshark on port 9000 (udp server is listening on it).
2. Start udp server (expected packet number is set to 1)
3. Start udp client on the client machine (start sending packets, first
packet number=1)
4. When udp server signal packet loss stop the client.
5. If packet loss is not signalled try to resize the udp server form, or
reduce time interval on the client (min=0 max speed).
5. Search inside wireshark the expected lost packet: I can see the
packet (the first 4 bytes correspond to the wireshark packet number).

If I set Interval=0 (max speed) on the client, the bitrate exceeds
100Mbps, but some packets are lost.

 It is not the messages which interfere, but GUI message processing can
 be very slow compared to network messages and while a GUI message is
 processed, no other message of the same thread can be processed.
 
 So I've created a worker thread that
 manage socket in its own message loop.
 
 That's perfect. But be sure to avoid using Synchronize or to block your
 thread while the GUI handle your messages. You really have the thread
 pumping messages as fast as possible. Just read the UDP socket and put
 the message in a queue for the GUI thread, then signal the GUI that the
 queue has a new message and let the thread pump the next message.

 Look at how your worker thread handle messages. As I said above, it has
 to be as fast as possible. Just receive the data into some kind of queue
 and signal it to the GUI thread without ever waiting for the GUI thread
 to handle the data.

 Probably not. At least you have to pass data to the GUI thread.


This is the windows procedure of the udp server thread:

procedure TUDPServer.ThreadWndProc(var aMessage:TMessage);
begin
 if aMessage.Msg=WM_UDP_LISTEN then
  begin
fExpected:=1;
fWS.Listen;
  end;
  if aMessage.Msg=WM_UDP_CLOSE then
  begin
fWS.Close;
  end;
  inherited ThreadWndProc(aMessage);
end;


and this is the DataAvailable of the socket:

procedure TUDPServer.WSocketDataAvailable(Sender: TObject; Error: Word);
var
  lBuffer:array[0..1500] of AnsiChar;
  lLen:integer;
  lSrc:TSockAddrIn;
  lSrcLen:integer;
  lRx:integer;
begin
  lSrcLen:=SizeOf(lSrc);
  lLen:=fWS.ReceiveFrom(@lBuffer,SizeOf(lBuffer),lSrc,lSrcLen);
  if lLen=0 then
  begin
inc(pBR,lLen);
move(lBuffer[0],lRx,4);
if lRx fExpected then
  PostMessage(self.fHandle,WM_UDP_DATA,lRx,fExpected);
fExpected:=lRx+1;
if lLenfExpectedSize then
  PostMessage(self.fHandle,WM_UDP_SIZE,lLen,fExpectedSize);
  end;
end;

If the thread detects a packet loss or a packet size error (size error
never happened) it sends a message to the GUI thread (self.fHandle).
No other operation is done.

 One last note: Disable any firewall and security product to do your
 testing. Many of those security products are trapping network traffic
 and can slow down thruput and may have bugs. So in case of difficulties
 like you have, it is better to disable everything and use a bare bone
 clean computer setup. Of course later you'll turn security back on.

Yes I have no firewall.

Another thing:
I have tried using udp client/server on the same computer, and in this
case the packet loss is reached only trasmitting at the max speed
possible, but:
1. Wireshark doesn't capture packets on the same machine.
2. The cpu goes very high.
So I think that packet loss is possible in this situation. I prefere to
use two separated laptops.

My client/server project size is only 12KB, is it possible to attach it
to the mail? Someone could try it...
If you think that could be a good example in order to test network udp
performance (and it is not buggy), it could be added to the user made
section of the ics site.

Thank you,

Emanuele
--
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 packet loss

2011-02-27 Thread Francois PIETTE

My client/server project size is only 12KB, is it possible to attach it
to the mail? Someone could try it...


It don't primize, but you may send the source code to me (no executable 
please) I will try to test it. Include complete projects so that I can test 
within a few minutes, and instructions to reproduce the issue.


--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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 packet loss

2011-02-27 Thread emanuele bizzarri
Hi,
now I've made a console application for the UDP server, but nothing changes.
I see packet loss inside application, but all packets are correctly
captured by wireshark.

Thankyou,
Emanuele

Il 27/02/2011 15.09, Francois PIETTE ha scritto:
 My client/server project size is only 12KB, is it possible to attach it
 to the mail? Someone could try it...
 
 It don't primize, but you may send the source code to me (no executable
 please) I will try to test it. Include complete projects so that I can
 test within a few minutes, and instructions to reproduce the issue.
 
 -- 
 francois.pie...@overbyte.be
 The author of the freeware multi-tier middleware MidWare
 The author of the freeware Internet Component Suite (ICS)
 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

-- 
Ing. Emanuele Bizzarri
Software Development Department
e-works s.r.l.
41011 - Campogalliano - Modena - Italy
tel. +39 059 2929081 int. 23
fax +39 059 2925035

e-mail: e.bizza...@e-works.it - http://www.e-works.it
-
La presente comunicazione, che potrebbe contenere informazioni riservate
e/o protette da segreto professionale, è indirizzata esclusivamente ai
destinatari della medesima qui indicati. Le opinioni, le conclusioni e
le altre informazioni qui contenute, che non siano relative alla nostra
attività caratteristica, devono essere considerate come non inviate né
avvalorate da noi. Tutti i pareri e le informazioni qui contenuti sono
soggetti ai termini ed alle condizioni previsti dagli accordi che
regolano il nostro rapporto con il cliente. Nel caso in cui abbiate
ricevuto per errore la presente comunicazione, vogliate cortesemente
darcene immediata notizia, rispondendo a questo stesso indirizzo di
e-mail, e poi procedere alla cancellazione di questo messaggio dal
Vostro sistema. E' strettamente proibito e potrebbe essere fonte di
violazione di legge qualsiasi uso, comunicazione, copia o diffusione dei
contenuti di questa comunicazione da parte di chi la abbia ricevuta per
errore o in violazione degli scopi della presente.
-
This communication, that may contain confidential and/or legally
privileged information, is intended solely for the use of the intended
addressees. Opinions, conclusions and other information contained in
this message, that do not relate to the official business of this firm,
shall be considered as not given or endorsed by it. Every opinion or
advice contained in this communication is subject to the terms and
conditions provided by the agreement governing the engagement with such
a client. If you have received this communication in error, please
notify us immediately by responding to this email and then delete it
from your system. Any use, disclosure, copying or distribution of the
contents of this communication by a not-intended recipient or in
violation of the purposes of this communication is strictly prohibited
and may be unlawful.

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

2011-02-27 Thread Francois PIETTE

Hi,

I have received your code and looking at it.
I cannot reproduce the packet loss on localhost.
I can reproduce on different computers, but I found a flaw in your design: 
remember TWSocket use non blocking. SendTo will fail if winsock is not able 
to receive data and you don't check that condition.

Here is how I found the problem:
procedure TForm1.OnTimer(aSender:TObject);
begin
 if fWS.State=wsConnected then
 begin
   move(fCounter,fData^,4);
   if fWS.SendTo(fPeerSrc,fPeerSrcLen,fData,fDataSize) = fDataSize then 
 test changed

   begin
 inc(fCounter);
 inc(fBR,fDataSize);
   end
   else
   ShowMessage('send failed'); 
message displayed

   Restart;
 end;
end;

You can't call SendTo as fast as you like when the socket is using async 
mode.

Before sending, you should check if the event OnDataSent has been triggered.
I'm not sure you correctly checked with wireshark that all packets where 
sent actually because their aren't when SendTo fails.


--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be



- Original Message - 
From: emanuele bizzarri e.bizza...@e-works.it

To: twsocket@elists.org
Sent: Sunday, February 27, 2011 7:05 PM
Subject: Re: [twsocket] udp packet loss


Hi,
now I've made a console application for the UDP server, but nothing changes.
I see packet loss inside application, but all packets are correctly
captured by wireshark.

Thankyou,
Emanuele

Il 27/02/2011 15.09, Francois PIETTE ha scritto:

My client/server project size is only 12KB, is it possible to attach it
to the mail? Someone could try it...


It don't primize, but you may send the source code to me (no executable
please) I will try to test it. Include complete projects so that I can
test within a few minutes, and instructions to reproduce the issue.

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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 packet loss

2011-02-26 Thread Francois PIETTE

I've a problem with udp.
Often my application detects packet losses.


At first glance, this is expected with UDP. By construction UDP is an 
unreliable transport.



In order to systematically reproduce the problem, I've used the
following configuration.
I use 2 pc connected with a cross cable.
The client sends udp numbered packets to the server.
Packet size is 1460. One packet is sent every 1 ms (about 11 Mbps).

I use wireshark to analyze the traffic on the server machine.
I see that all the packets arrive on the server, but not inside the
application.

Packet loss increases if I resize the form, so I've made a worker thread
in order to manage udp server socket messages, but the problem remains.


This is normal. If the application is not able to read UDP packets as fast 
as packets are incomming, they are simply dropped. There is no flow control 
with UDP. This is how UDP is working.



Have you any suggestion to resolve this problem?


The easiest way is to use TCP which is a reliable protocol, with flow 
control, retries and everything needed to make it reliable.



Maybe the socket configuration should be changed?


Won't change anything.
If you still want to use UDP, you may use a dedicated thread to handle 
communication and give it a high priority so that it will receive CPU before 
the user interface.




I attach the code of server, client and worker thread:


Sorry no time to read your code. i just browsed quickly and see you don't 
create TWSocket in thread's execute method, so all events are handled by the 
main thread. This is a flaw in your design, at least.


--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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 packet loss

2011-02-26 Thread emanuele bizzarri
Hi Francois,
thank you for your response.
I've created the socket inside DoInit, that is an override method of the
virtual DoInit of the worker thread.
The DoInit method is called inside Execute method, so the socket is
created by the thread and its messages are handled by it (try to use
GetThreadID inside socket callbacks).
As you can see in my code I've also try to set tpTimeCritical to thread
priority, but without any success.
The worker thread check if expected packet number (first four bytes)
corresponds to expected packet number.
In my example I think that the gui should not interfere with worker thread.

I can't use tcp in my application, I need udp.

Any ideas?

Thank you,
Emanuele



Il 26/02/2011 16.29, Francois PIETTE ha scritto:
 I've a problem with udp.
 Often my application detects packet losses.
 
 At first glance, this is expected with UDP. By construction UDP is an
 unreliable transport.
 
 In order to systematically reproduce the problem, I've used the
 following configuration.
 I use 2 pc connected with a cross cable.
 The client sends udp numbered packets to the server.
 Packet size is 1460. One packet is sent every 1 ms (about 11 Mbps).

 I use wireshark to analyze the traffic on the server machine.
 I see that all the packets arrive on the server, but not inside the
 application.

 Packet loss increases if I resize the form, so I've made a worker thread
 in order to manage udp server socket messages, but the problem remains.
 
 This is normal. If the application is not able to read UDP packets as
 fast as packets are incomming, they are simply dropped. There is no flow
 control with UDP. This is how UDP is working.
 
 Have you any suggestion to resolve this problem?
 
 The easiest way is to use TCP which is a reliable protocol, with flow
 control, retries and everything needed to make it reliable.
 
 Maybe the socket configuration should be changed?
 
 Won't change anything.
 If you still want to use UDP, you may use a dedicated thread to handle
 communication and give it a high priority so that it will receive CPU
 before the user interface.
 
 
 I attach the code of server, client and worker thread:
 
 Sorry no time to read your code. i just browsed quickly and see you
 don't create TWSocket in thread's execute method, so all events are
 handled by the main thread. This is a flaw in your design, at least.
 
 -- 
 francois.pie...@overbyte.be
 The author of the freeware multi-tier middleware MidWare
 The author of the freeware Internet Component Suite (ICS)
 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

-- 
Ing. Emanuele Bizzarri
Software Development Department
e-works s.r.l.
41011 - Campogalliano - Modena - Italy
tel. +39 059 2929081 int. 23
fax +39 059 2925035

e-mail: e.bizza...@e-works.it - http://www.e-works.it
-
La presente comunicazione, che potrebbe contenere informazioni riservate
e/o protette da segreto professionale, è indirizzata esclusivamente ai
destinatari della medesima qui indicati. Le opinioni, le conclusioni e
le altre informazioni qui contenute, che non siano relative alla nostra
attività caratteristica, devono essere considerate come non inviate né
avvalorate da noi. Tutti i pareri e le informazioni qui contenuti sono
soggetti ai termini ed alle condizioni previsti dagli accordi che
regolano il nostro rapporto con il cliente. Nel caso in cui abbiate
ricevuto per errore la presente comunicazione, vogliate cortesemente
darcene immediata notizia, rispondendo a questo stesso indirizzo di
e-mail, e poi procedere alla cancellazione di questo messaggio dal
Vostro sistema. E' strettamente proibito e potrebbe essere fonte di
violazione di legge qualsiasi uso, comunicazione, copia o diffusione dei
contenuti di questa comunicazione da parte di chi la abbia ricevuta per
errore o in violazione degli scopi della presente.
-
This communication, that may contain confidential and/or legally
privileged information, is intended solely for the use of the intended
addressees. Opinions, conclusions and other information contained in
this message, that do not relate to the official business of this firm,
shall be considered as not given or endorsed by it. Every opinion or
advice contained in this communication is subject to the terms and
conditions provided by the agreement governing the engagement with such
a client. If you have received this communication in error, please
notify us immediately by responding to this email and then delete it
from your system. Any use, disclosure, copying or distribution of the
contents of this communication by a not-intended recipient or in
violation of the purposes of this communication is strictly prohibited
and may be unlawful.

--
To unsubscribe or 

Re: [twsocket] udp packet loss

2011-02-26 Thread Angus Robertson - Magenta Systems Ltd
 As you can see in my code I've also try to set tpTimeCritical to 
 thread priority, but without any success.

Try changing the application priority:

SetPriorityClass (GetCurrentProcess, HIGH_PRIORITY_CLASS); 

or even REALTIME_PRIORITY_CLASS, but this last one can be dangerous since
Windows may lock up if your application goes wild. 

Angus


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

2011-02-26 Thread Francois PIETTE

As you can see


Sorry, no time to examine it in details.
Priority is given to my business customers...


in my code I've also try to set tpTimeCritical to thread
priority, but without any success.



The worker thread check if expected packet number (first four bytes)
corresponds to expected packet number.
I can't use tcp in my application, I need udp.


You software, when using UDP, must be preapred to packet loss, duplicate 
packets and packet in incorrect order. If it is not possible in your case, 
you can't use UDP. UDP is a simple packet protocol with only best delivery 
effort. This is not an issue with ICS, it is simple how UDP works.


In my example I think that the gui should not interfere with worker 
thread.

Any ideas?


If you loose packet, then your software, or the whole computer is not fast 
enough to handle all packets as they are delivered. Buy a faster computer or 
optimize the software.


Of course also check if your network card is OK and setup for 100 Mbps.


I can't use tcp in my application, I need udp.


Why do you think you must use UDP ?
Why isn't TCP good for you ?

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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 packet loss

2011-02-26 Thread emanuele bizzarri
Hi,
I need to use udp because my application is an h323/sip endpoint.
RTP uses udp sockets to transmit/receive audio/video data.
RTCP can be used to manage packet loss.

But in this case packets are not lost by the network. If I use wireshark
I can see all the packets.

I think that there is a problem in my code. I know that gui messages can
interfere with socket messages. So I've created a worker thread that
manage socket in its own message loop.

Could be the problem in the way I create/use the message loop in worker
thread?
This is the execute method (DoInit create the socket):

procedure TWorkerThread.Execute;
begin
  DoInit;
  MessageLoop;
end;

Inside the message loop method, I allocate fThreadHandle and then begin
dispatch messages.

procedure TWorkerThread.MessageLoop;
var
  lMsg:TMsg;
begin
  fThreadHandle:=AllocateHWnd(ThreadWndProc);
  PeekMessage(lMsg,0,0,0,PM_NOREMOVE);
  SetEvent(fResumeEvent);
  //GetMessage return false on WM_QUIT
  while (GetMessage(lMsg,0,0,0))and(not self.Terminated) do
  begin
TranslateMessage(lMsg);
DispatchMessage(lMsg);
  end;
  DeallocateHWnd(fThreadHandle);
end;

The DoInit method is called before AllocateHWnd, so the socket is
created before. Could be here the problem?

It seems that the thread is not fast enought to elaborate socket
messages. Or that the gui slow the worker thread in some way. If I call
GetCurrentThreadID inside the DataAvailable the result is the id of the
worker thread.
The only thing done inside the DataAvailable callback is check packet
number.
The cpu is used about 12%.

I've tried to set the process priority (thank you Angus), but nothig
changes.

What kind of performance do you reach using udp sockets? I think that my
performance are not satisfactory.

Thank you for your help.

Emanuele




Il 26/02/2011 21.15, Francois PIETTE ha scritto:
 As you can see
 
 Sorry, no time to examine it in details.
 Priority is given to my business customers...
 
 in my code I've also try to set tpTimeCritical to thread
 priority, but without any success.
 
 The worker thread check if expected packet number (first four bytes)
 corresponds to expected packet number.
 I can't use tcp in my application, I need udp.
 
 You software, when using UDP, must be preapred to packet loss, duplicate
 packets and packet in incorrect order. If it is not possible in your
 case, you can't use UDP. UDP is a simple packet protocol with only best
 delivery effort. This is not an issue with ICS, it is simple how UDP works.
 
 In my example I think that the gui should not interfere with worker
 thread.
 Any ideas?
 
 If you loose packet, then your software, or the whole computer is not
 fast enough to handle all packets as they are delivered. Buy a faster
 computer or optimize the software.
 
 Of course also check if your network card is OK and setup for 100 Mbps.
 
 I can't use tcp in my application, I need udp.
 
 Why do you think you must use UDP ?
 Why isn't TCP good for you ?
 
 -- 
 francois.pie...@overbyte.be
 The author of the freeware multi-tier middleware MidWare
 The author of the freeware Internet Component Suite (ICS)
 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

-- 
Ing. Emanuele Bizzarri
Software Development Department
e-works s.r.l.
41011 - Campogalliano - Modena - Italy
tel. +39 059 2929081 int. 23
fax +39 059 2925035

e-mail: e.bizza...@e-works.it - http://www.e-works.it
-
La presente comunicazione, che potrebbe contenere informazioni riservate
e/o protette da segreto professionale, è indirizzata esclusivamente ai
destinatari della medesima qui indicati. Le opinioni, le conclusioni e
le altre informazioni qui contenute, che non siano relative alla nostra
attività caratteristica, devono essere considerate come non inviate né
avvalorate da noi. Tutti i pareri e le informazioni qui contenuti sono
soggetti ai termini ed alle condizioni previsti dagli accordi che
regolano il nostro rapporto con il cliente. Nel caso in cui abbiate
ricevuto per errore la presente comunicazione, vogliate cortesemente
darcene immediata notizia, rispondendo a questo stesso indirizzo di
e-mail, e poi procedere alla cancellazione di questo messaggio dal
Vostro sistema. E' strettamente proibito e potrebbe essere fonte di
violazione di legge qualsiasi uso, comunicazione, copia o diffusione dei
contenuti di questa comunicazione da parte di chi la abbia ricevuta per
errore o in violazione degli scopi della presente.
-
This communication, that may contain confidential and/or legally
privileged information, is intended solely for the use of the intended
addressees. Opinions, conclusions and other information contained in
this message, that do not relate to the official business of this 

Re: [twsocket] udp packet loss

2011-02-26 Thread Francois PIETTE

I need to use udp because my application is an h323/sip endpoint.
RTP uses udp sockets to transmit/receive audio/video data.
RTCP can be used to manage packet loss.


OK, good.


But in this case packets are not lost by the network. If I use wireshark
I can see all the packets.


I'll assume you use a direct cable or put wireshark at the receiving 
computer because sending a packet is not a problem. Having the packet 
reaching the network card of the receiving computer is a different thing if 
there is something in between.


Have you checked your network card is operating at 100 Mbps ?


I think that there is a problem in my code.


Probably. If your network was bad, you would already know it.


I know that gui messages can interfere with socket messages.


It is not the messages which interfere, but GUI message processing can be 
very slow compared to network messages and while a GUI message is processed, 
no other message of the same thread can be processed.



So I've created a worker thread that
manage socket in its own message loop.


That's perfect. But be sure to avoid using Synchronize or to block your 
thread while the GUI handle your messages. You really have the thread 
pumping messages as fast as possible. Just read the UDP socket and put the 
message in a queue for the GUI thread, then signal the GUI that the queue 
has a new message and let the thread pump the next message.



Could be the problem in the way I create/use the message loop in worker
thread?
This is the execute method (DoInit create the socket):


Your code looks OK.


The DoInit method is called before AllocateHWnd, so the socket is
created before. Could be here the problem?


No, it is OK.


It seems that the thread is not fast enought to elaborate socket
messages.


Look at how your worker thread handle messages. As I said above, it has to 
be as fast as possible. Just receive the data into some kind of queue and 
signal it to the GUI thread without ever waiting for the GUI thread to 
handle the data.



Or that the gui slow the worker thread in some way.


If the GUI thread is CPU bound, then it will hog most of the CPU unless the 
workerthread has a higher priority.



If I call GetCurrentThreadID inside the DataAvailable the result
is the id of the worker thread.


So the socket is correctly created.


The only thing done inside the DataAvailable callback is check packet
number.


Probably not. At least you have to pass data to the GUI thread.



The cpu is used about 12%.


Good news.


I've tried to set the process priority (thank you Angus), but nothig
changes.



What kind of performance do you reach using udp sockets? I think that my
performance are not satisfactory.


Depending on your hardware, you should be able to handle 100 Mbps and more. 
If you write data to disk, this may slow down things. If you display data, 
this may slow down as well.


You may try a simple program which do nothing withe the data except checing 
the packet number and see how many packets you can receive.


One last note: Disable any firewall and security product to do your testing. 
Many of those security products are trapping network traffic and can slow 
down thruput and may have bugs. So in case of difficulties like you have, it 
is better to disable everything and use a bare bone clean computer setup. Of 
course later you'll turn security back on.


--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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 broadcast error Permission denied

2010-12-23 Thread Francois PIETTE

To broadcast on 255.25.255.255, use connect() and then send().
Connect() will set SO_BROADCAST option at the socket level.

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be


- Original Message - 
From: Arno Garrels arno.garr...@gmx.de

To: twsocket@elists.org
Sent: Thursday, December 23, 2010 12:20 PM
Subject: [twsocket] UDP broadcast error Permission denied



Hi,

When I try a SendTo() address 255.255.255.255 with an UDP listening
TWSocket I get error WSAEACCES Permission denied, is this normal?.
SendTo() 192.168.1.255 works, Firewall is turned off.

procedure TMyServer.UdpListen;
begin
 if FUDP = nil then
   FUDP := TWSocket.Create(nil);
 FUDP.Proto := 'udp';
 FUDP.Addr  := '0.0.0.0'; // listening on one interface 
doesn't change it.

 FUDP.Port  := '30003';
 FUDP.OnDataAvailable   := UdpDataAvailable;
 FUDP.ReuseAddr := TRUE;
 FUDP.Listen;
end;

procedure TMyServer.SendHelo;
var
 Dst: TSockAddrIn;
 DstLen : Integer;
 Buf: AnsiString;
begin
 FillChar(Dst, SizeOf(Dst), 0);
 Dst.sin_family  := AF_INET;
 Dst.sin_port:= WSocket_htons(StrToIntDef(FPort, 30003));
 Dst.sin_addr.S_addr := u_long(INADDR_BROADCAST);
 Buf := 'Helo';
 if FUDP.SendTo(Dst, DstLen, PAnsiChar(Buf), Length(Buf) + 1) = -1 then
   raise Exception.Create(WSocketErrorDesc(WSocket_WSAGetLastError));
end;

--
Arno Garrels
--
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 broadcast error Permission denied

2010-12-23 Thread Arno Garrels
Francois PIETTE wrote:
 To broadcast on 255.25.255.255, use connect() and then send().
 Connect() will set SO_BROADCAST option at the socket level.

Thanks, I have to use the listening socket in order to avoid 
Bind errors, setting SO_BROADCAST after Listen actually works fine.

Happy Holidays

-- 
Arno Garrels

 
 --
 francois.pie...@overbyte.be
 The author of the freeware multi-tier middleware MidWare
 The author of the freeware Internet Component Suite (ICS)
 http://www.overbyte.be
 
 
 - Original Message -
 From: Arno Garrels arno.garr...@gmx.de
 To: twsocket@elists.org
 Sent: Thursday, December 23, 2010 12:20 PM
 Subject: [twsocket] UDP broadcast error Permission denied
 
 
 Hi,
 
 When I try a SendTo() address 255.255.255.255 with an UDP listening
 TWSocket I get error WSAEACCES Permission denied, is this normal?.
 SendTo() 192.168.1.255 works, Firewall is turned off.
 
 procedure TMyServer.UdpListen;
 begin
  if FUDP = nil then
FUDP := TWSocket.Create(nil);
  FUDP.Proto := 'udp';
  FUDP.Addr  := '0.0.0.0'; // listening on one interface
 doesn't change it.
  FUDP.Port  := '30003';
  FUDP.OnDataAvailable   := UdpDataAvailable;
  FUDP.ReuseAddr := TRUE;
  FUDP.Listen;
 end;
 
 procedure TMyServer.SendHelo;
 var
  Dst: TSockAddrIn;
  DstLen : Integer;
  Buf: AnsiString;
 begin
  FillChar(Dst, SizeOf(Dst), 0);
  Dst.sin_family  := AF_INET;
  Dst.sin_port:= WSocket_htons(StrToIntDef(FPort, 30003));
  Dst.sin_addr.S_addr := u_long(INADDR_BROADCAST);
  Buf := 'Helo';
  if FUDP.SendTo(Dst, DstLen, PAnsiChar(Buf), Length(Buf) + 1) = -1
then raise
 Exception.Create(WSocketErrorDesc(WSocket_WSAGetLastError)); end;
 
 --
 Arno Garrels
 --
 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...

2010-03-24 Thread wilfried Mestdagh
Hi,

 WSocket1.Addr:='192.168.1.2';
 WSocket1.port:='9600';
 I get an error 10049. 
Means you cannot bind to that address. '192.168.1.2' is the address on the
remote machine, you can not listen on that.

 The only difference I can see is the sending local port number is not
9600.

This should make no difference. You can set local port of course. There is a
property for that.

-- 
mvg, Wilfried
http://www.mestdagh.biz

-Oorspronkelijk bericht-
Van: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] Namens
zayin
Verzonden: woensdag 24 maart 2010 1:12
Aan: twsocket@elists.org
Onderwerp: [twsocket] UDP...

Hello,

I ran into this a couple years ago and I found a work around so I dropped
it. Now, new computer, new OS, new task. So, any reasons for my failure that
might have been computer/OS related are...

I am using Wireshark to verify what I am seeing.

Using D2007 and ICS version 5.25, UDP with TWSocket.

When I call 'Listen' after setting:

WSocket1.Addr:='192.168.1.2';
WSocket1.port:='9600';

I get an error 10049. Then of course if I send some bytes I get a 10057
error.

When I call 'Connect' after setting:

WSocket1.Addr:='192.168.1.2';
WSocket1.port:='9600';

I can send the bytes and Wireshark shows them as transmitted and I get a
reply from 192.168.1.2.

The reply I get back indicates there is an error in the bytes. I KNOW the
bytes are correct. The device also supports TCP with the same bytes and when
I use TCP all is good. I have other software, I did not create, and it works
with UDP using the same byte stream.

The only difference I can see is the sending local port number is not 9600.
I am not sure why that matters. The software that does work does have a
local port number of 9600. And after hours, that is the only difference I
can see.

The source is below and I can upload a project if someone needs it.

Any ideas? What am I missing?

Ciao,

Mark

unit Main;

interface

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

type
  TForm2 = class(TForm)
Memo1: TMemo;
WSocket1: TWSocket;
ListenStartBtn: TButton;
ListenStopBtn: TButton;
Label1: TLabel;
Label2: TLabel;
ConnectStartBtn: TButton;
StopConnectBtn: TButton;
IcsLogger1: TIcsLogger;
procedure ListenStartBtnClick(Sender: TObject);
procedure WSocket1Error(Sender: TObject);
procedure WSocket1SessionConnected(Sender: TObject; ErrCode: Word);
procedure WSocket1SessionClosed(Sender: TObject; ErrCode: Word);
procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
procedure ListenStopBtnClick(Sender: TObject);
procedure ConnectStartBtnClick(Sender: TObject);
  private
holdingBuff:array [0..2048] of byte;
  public
{ Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

var
 outBuffer:array [0..17] of byte =
($80,$00,$02,$00,$02,$00,$00,$04,$00,$03,$01,$01,$B0,$00,$00,$00,$00,$01);

procedure TForm2.ConnectStartBtnClick(Sender: TObject);
begin
 Memo1.Lines.Add('');
 Memo1.Lines.Add('ConnectStartBtnClick');
 WSocket1.Addr:='192.168.1.2';
 WSocket1.port:='9600';
 Memo1.Lines.Add('Connect');
 WSocket1.Connect;
 Memo1.Lines.Add('Send');
 WSocket1.Send(@outBuffer,18);
end;

procedure TForm2.ListenStartBtnClick(Sender: TObject);
begin
 Memo1.Lines.Add('');
 Memo1.Lines.Add('ListenStartBtnClick');
 WSocket1.Addr:='192.168.1.2';
 WSocket1.port:='9600';
 Memo1.Lines.Add('Listen');
 WSocket1.Listen;
 Memo1.Lines.Add('Send');
 WSocket1.Send(@outBuffer,18);
end;

procedure TForm2.ListenStopBtnClick(Sender: TObject);
begin
 Memo1.Lines.Add('Stop');
 WSocket1.Close;
end;

procedure TForm2.WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
var
 byteCount:integer;
begin
 if (ErrCode  0) then
  Memo1.Lines.Add('WSocket1DataAvailable: ' + IntToStr(ErrCode));

 Memo1.Lines.Add('WSocket1DataAvailable');
 byteCount:=WSocket1.Receive(@holdingBuff[0],sizeOf(holdingBuff));
 if (byteCount  1) then
  Exit;
 Memo1.Lines.Add(IntToStr(byteCount));
end;

procedure TForm2.WSocket1Error(Sender: TObject);
begin
 Memo1.Lines.Add('WSocket1Error: ' + IntToStr(WSocket1.LastError));
end;

procedure TForm2.WSocket1SessionClosed(Sender: TObject; ErrCode: Word);
begin
 if (ErrCode  0) then
  Memo1.Lines.Add('WSocket1SessionClosed: ' + IntToStr(ErrCode));
 Memo1.Lines.Add('WSocket1SessionClosed');
end;

procedure TForm2.WSocket1SessionConnected(Sender: TObject; ErrCode: Word);
begin
 if (ErrCode  0) then
  Memo1.Lines.Add('WSocket1SessionConnected: ' + IntToStr(ErrCode));
 Memo1.Lines.Add('WSocket1SessionConnected');
end;

end.

DFM---

object Form2: TForm2
  Left = 758
  Top = -807
  Caption = 'Form2'
  ClientHeight = 714
  ClientWidth = 667
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object 

Re: [twsocket] UDP...

2010-03-24 Thread zayin
Hi,

Thanks. 

I set the addr to 0.0.0.0, switched to SendTo and the reply was correct.

Since I will be communicating with many of these external devices I wanted
one TWSocket for each external device, that was why I set the addr field to
the external devices IP address. Using 0.0.0.0 it appears all the external
devices will reply through that one TWSocket and I will need to sort them
out in the OnDataAvaliable.

Is that correct?

Thanks,

Mark

-Original Message-
From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On
Behalf Of wilfried Mestdagh
Sent: Wednesday, March 24, 2010 3:03 AM
To: 'ICS support mailing'
Subject: Re: [twsocket] UDP...

Hi,

 WSocket1.Addr:='192.168.1.2';
 WSocket1.port:='9600';
 I get an error 10049. 
Means you cannot bind to that address. '192.168.1.2' is the address on the
remote machine, you can not listen on that.

 The only difference I can see is the sending local port number is not
9600.

This should make no difference. You can set local port of course. There is a
property for that.

-- 
mvg, Wilfried
http://www.mestdagh.biz

-Oorspronkelijk bericht-
Van: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] Namens
zayin
Verzonden: woensdag 24 maart 2010 1:12
Aan: twsocket@elists.org
Onderwerp: [twsocket] UDP...

Hello,

I ran into this a couple years ago and I found a work around so I dropped
it. Now, new computer, new OS, new task. So, any reasons for my failure that
might have been computer/OS related are...

I am using Wireshark to verify what I am seeing.

Using D2007 and ICS version 5.25, UDP with TWSocket.

When I call 'Listen' after setting:

WSocket1.Addr:='192.168.1.2';
WSocket1.port:='9600';

I get an error 10049. Then of course if I send some bytes I get a 10057
error.

When I call 'Connect' after setting:

WSocket1.Addr:='192.168.1.2';
WSocket1.port:='9600';

I can send the bytes and Wireshark shows them as transmitted and I get a
reply from 192.168.1.2.

The reply I get back indicates there is an error in the bytes. I KNOW the
bytes are correct. The device also supports TCP with the same bytes and when
I use TCP all is good. I have other software, I did not create, and it works
with UDP using the same byte stream.

The only difference I can see is the sending local port number is not 9600.
I am not sure why that matters. The software that does work does have a
local port number of 9600. And after hours, that is the only difference I
can see.

The source is below and I can upload a project if someone needs it.

Any ideas? What am I missing?

Ciao,

Mark

unit Main;

interface

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

type
  TForm2 = class(TForm)
Memo1: TMemo;
WSocket1: TWSocket;
ListenStartBtn: TButton;
ListenStopBtn: TButton;
Label1: TLabel;
Label2: TLabel;
ConnectStartBtn: TButton;
StopConnectBtn: TButton;
IcsLogger1: TIcsLogger;
procedure ListenStartBtnClick(Sender: TObject);
procedure WSocket1Error(Sender: TObject);
procedure WSocket1SessionConnected(Sender: TObject; ErrCode: Word);
procedure WSocket1SessionClosed(Sender: TObject; ErrCode: Word);
procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
procedure ListenStopBtnClick(Sender: TObject);
procedure ConnectStartBtnClick(Sender: TObject);
  private
holdingBuff:array [0..2048] of byte;
  public
{ Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

var
 outBuffer:array [0..17] of byte =
($80,$00,$02,$00,$02,$00,$00,$04,$00,$03,$01,$01,$B0,$00,$00,$00,$00,$01);

procedure TForm2.ConnectStartBtnClick(Sender: TObject);
begin
 Memo1.Lines.Add('');
 Memo1.Lines.Add('ConnectStartBtnClick');
 WSocket1.Addr:='192.168.1.2';
 WSocket1.port:='9600';
 Memo1.Lines.Add('Connect');
 WSocket1.Connect;
 Memo1.Lines.Add('Send');
 WSocket1.Send(@outBuffer,18);
end;

procedure TForm2.ListenStartBtnClick(Sender: TObject);
begin
 Memo1.Lines.Add('');
 Memo1.Lines.Add('ListenStartBtnClick');
 WSocket1.Addr:='192.168.1.2';
 WSocket1.port:='9600';
 Memo1.Lines.Add('Listen');
 WSocket1.Listen;
 Memo1.Lines.Add('Send');
 WSocket1.Send(@outBuffer,18);
end;

procedure TForm2.ListenStopBtnClick(Sender: TObject);
begin
 Memo1.Lines.Add('Stop');
 WSocket1.Close;
end;

procedure TForm2.WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
var
 byteCount:integer;
begin
 if (ErrCode  0) then
  Memo1.Lines.Add('WSocket1DataAvailable: ' + IntToStr(ErrCode));

 Memo1.Lines.Add('WSocket1DataAvailable');
 byteCount:=WSocket1.Receive(@holdingBuff[0],sizeOf(holdingBuff));
 if (byteCount  1) then
  Exit;
 Memo1.Lines.Add(IntToStr(byteCount));
end;

procedure TForm2.WSocket1Error(Sender: TObject);
begin
 Memo1.Lines.Add('WSocket1Error: ' + IntToStr(WSocket1.LastError));
end;

procedure TForm2.WSocket1SessionClosed(Sender: TObject; ErrCode: Word);
begin
 if (ErrCode  0) then
  Memo1.Lines.Add

Re: [twsocket] UDP...

2010-03-24 Thread Francois PIETTE
Using address 0.0.0.0 instruct TWSocket to listen on all the interfaces in 
the computer.
The alternative was to use only one of the IP adresses of the computer and 
then TWSocket would accepte connection originating only from that interface.
You cannot set an IP address of an external device and ask TWSocket to 
listen on it !


--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be

- Original Message - 
From: zayin za...@pdq.net

To: 'ICS support mailing' twsocket@elists.org
Sent: Wednesday, March 24, 2010 1:55 PM
Subject: Re: [twsocket] UDP...



Hi,

Thanks.

I set the addr to 0.0.0.0, switched to SendTo and the reply was correct.

Since I will be communicating with many of these external devices I wanted
one TWSocket for each external device, that was why I set the addr field 
to

the external devices IP address. Using 0.0.0.0 it appears all the external
devices will reply through that one TWSocket and I will need to sort them
out in the OnDataAvaliable.

Is that correct?

Thanks,

Mark

-Original Message-
From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On
Behalf Of wilfried Mestdagh
Sent: Wednesday, March 24, 2010 3:03 AM
To: 'ICS support mailing'
Subject: Re: [twsocket] UDP...

Hi,


WSocket1.Addr:='192.168.1.2';
WSocket1.port:='9600';
I get an error 10049.

Means you cannot bind to that address. '192.168.1.2' is the address on the
remote machine, you can not listen on that.


The only difference I can see is the sending local port number is not

9600.

This should make no difference. You can set local port of course. There is 
a

property for that.

--
mvg, Wilfried
http://www.mestdagh.biz

-Oorspronkelijk bericht-
Van: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] 
Namens

zayin
Verzonden: woensdag 24 maart 2010 1:12
Aan: twsocket@elists.org
Onderwerp: [twsocket] UDP...

Hello,

I ran into this a couple years ago and I found a work around so I dropped
it. Now, new computer, new OS, new task. So, any reasons for my failure 
that

might have been computer/OS related are...

I am using Wireshark to verify what I am seeing.

Using D2007 and ICS version 5.25, UDP with TWSocket.

When I call 'Listen' after setting:

WSocket1.Addr:='192.168.1.2';
WSocket1.port:='9600';

I get an error 10049. Then of course if I send some bytes I get a 10057
error.

When I call 'Connect' after setting:

WSocket1.Addr:='192.168.1.2';
WSocket1.port:='9600';

I can send the bytes and Wireshark shows them as transmitted and I get a
reply from 192.168.1.2.

The reply I get back indicates there is an error in the bytes. I KNOW the
bytes are correct. The device also supports TCP with the same bytes and 
when
I use TCP all is good. I have other software, I did not create, and it 
works

with UDP using the same byte stream.

The only difference I can see is the sending local port number is not 
9600.

I am not sure why that matters. The software that does work does have a
local port number of 9600. And after hours, that is the only difference I
can see.

The source is below and I can upload a project if someone needs it.

Any ideas? What am I missing?

Ciao,

Mark

unit Main;

interface

uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, 
Forms,

 Dialogs, StdCtrls, WSocket, IcsLogger;

type
 TForm2 = class(TForm)
   Memo1: TMemo;
   WSocket1: TWSocket;
   ListenStartBtn: TButton;
   ListenStopBtn: TButton;
   Label1: TLabel;
   Label2: TLabel;
   ConnectStartBtn: TButton;
   StopConnectBtn: TButton;
   IcsLogger1: TIcsLogger;
   procedure ListenStartBtnClick(Sender: TObject);
   procedure WSocket1Error(Sender: TObject);
   procedure WSocket1SessionConnected(Sender: TObject; ErrCode: Word);
   procedure WSocket1SessionClosed(Sender: TObject; ErrCode: Word);
   procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
   procedure ListenStopBtnClick(Sender: TObject);
   procedure ConnectStartBtnClick(Sender: TObject);
 private
   holdingBuff:array [0..2048] of byte;
 public
   { Public declarations }
 end;

var
 Form2: TForm2;

implementation

{$R *.dfm}

var
outBuffer:array [0..17] of byte =
($80,$00,$02,$00,$02,$00,$00,$04,$00,$03,$01,$01,$B0,$00,$00,$00,$00,$01);

procedure TForm2.ConnectStartBtnClick(Sender: TObject);
begin
Memo1.Lines.Add('');
Memo1.Lines.Add('ConnectStartBtnClick');
WSocket1.Addr:='192.168.1.2';
WSocket1.port:='9600';
Memo1.Lines.Add('Connect');
WSocket1.Connect;
Memo1.Lines.Add('Send');
WSocket1.Send(@outBuffer,18);
end;

procedure TForm2.ListenStartBtnClick(Sender: TObject);
begin
Memo1.Lines.Add('');
Memo1.Lines.Add('ListenStartBtnClick');
WSocket1.Addr:='192.168.1.2';
WSocket1.port:='9600';
Memo1.Lines.Add('Listen');
WSocket1.Listen;
Memo1.Lines.Add('Send');
WSocket1.Send(@outBuffer,18);
end;

procedure TForm2.ListenStopBtnClick(Sender: TObject);
begin
Memo1.Lines.Add('Stop');
WSocket1.Close;
end

Re: [twsocket] UDP...

2010-03-24 Thread zayin
Hi,

Thanks.

 ...originating only from that interface.

I have done that kind of binding before using LocalAddr. I assume it would
be the same property for UDP.

OK. I have another application where I am using UDP and I set the addr
property to the remote IP address. Then I call connect, use send and
OnDataAvaliable and all works fine.

What would be the reason(s) that I am not able to do the same thing with
this new device? Error 10049 says I cannot bind to the remote address.  What
does the connect call, using UDP, send to the remote that caused the 10049
on one device and not others? I am so confused. ;)

Thanks for all the help,

Mark





-Original Message-
From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On
Behalf Of Francois PIETTE
Sent: Wednesday, March 24, 2010 12:50 PM
To: ICS support mailing
Subject: Re: [twsocket] UDP...

Using address 0.0.0.0 instruct TWSocket to listen on all the interfaces in 
the computer.
The alternative was to use only one of the IP adresses of the computer and 
then TWSocket would accepte connection originating only from that interface.
You cannot set an IP address of an external device and ask TWSocket to 
listen on it !

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be

- Original Message - 
From: zayin za...@pdq.net
To: 'ICS support mailing' twsocket@elists.org
Sent: Wednesday, March 24, 2010 1:55 PM
Subject: Re: [twsocket] UDP...


 Hi,

 Thanks.

 I set the addr to 0.0.0.0, switched to SendTo and the reply was correct.

 Since I will be communicating with many of these external devices I wanted
 one TWSocket for each external device, that was why I set the addr field 
 to
 the external devices IP address. Using 0.0.0.0 it appears all the external
 devices will reply through that one TWSocket and I will need to sort them
 out in the OnDataAvaliable.

 Is that correct?

 Thanks,

 Mark

 -Original Message-
 From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On
 Behalf Of wilfried Mestdagh
 Sent: Wednesday, March 24, 2010 3:03 AM
 To: 'ICS support mailing'
 Subject: Re: [twsocket] UDP...

 Hi,

 WSocket1.Addr:='192.168.1.2';
 WSocket1.port:='9600';
 I get an error 10049.
 Means you cannot bind to that address. '192.168.1.2' is the address on the
 remote machine, you can not listen on that.

 The only difference I can see is the sending local port number is not
 9600.

 This should make no difference. You can set local port of course. There is

 a
 property for that.

 -- 
 mvg, Wilfried
 http://www.mestdagh.biz

 -Oorspronkelijk bericht-
 Van: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] 
 Namens
 zayin
 Verzonden: woensdag 24 maart 2010 1:12
 Aan: twsocket@elists.org
 Onderwerp: [twsocket] UDP...

 Hello,

 I ran into this a couple years ago and I found a work around so I dropped
 it. Now, new computer, new OS, new task. So, any reasons for my failure 
 that
 might have been computer/OS related are...

 I am using Wireshark to verify what I am seeing.

 Using D2007 and ICS version 5.25, UDP with TWSocket.

 When I call 'Listen' after setting:

 WSocket1.Addr:='192.168.1.2';
 WSocket1.port:='9600';

 I get an error 10049. Then of course if I send some bytes I get a 10057
 error.

 When I call 'Connect' after setting:

 WSocket1.Addr:='192.168.1.2';
 WSocket1.port:='9600';

 I can send the bytes and Wireshark shows them as transmitted and I get a
 reply from 192.168.1.2.

 The reply I get back indicates there is an error in the bytes. I KNOW the
 bytes are correct. The device also supports TCP with the same bytes and 
 when
 I use TCP all is good. I have other software, I did not create, and it 
 works
 with UDP using the same byte stream.

 The only difference I can see is the sending local port number is not 
 9600.
 I am not sure why that matters. The software that does work does have a
 local port number of 9600. And after hours, that is the only difference I
 can see.

 The source is below and I can upload a project if someone needs it.

 Any ideas? What am I missing?

 Ciao,

 Mark

 unit Main;

 interface

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

 type
  TForm2 = class(TForm)
Memo1: TMemo;
WSocket1: TWSocket;
ListenStartBtn: TButton;
ListenStopBtn: TButton;
Label1: TLabel;
Label2: TLabel;
ConnectStartBtn: TButton;
StopConnectBtn: TButton;
IcsLogger1: TIcsLogger;
procedure ListenStartBtnClick(Sender: TObject);
procedure WSocket1Error(Sender: TObject);
procedure WSocket1SessionConnected(Sender: TObject; ErrCode: Word);
procedure WSocket1SessionClosed(Sender: TObject; ErrCode: Word);
procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
procedure ListenStopBtnClick(Sender: TObject);
procedure

Re: [twsocket] UDP...

2010-03-24 Thread Francois PIETTE

...originating only from that interface.


I have done that kind of binding before using LocalAddr. I assume it would
be the same property for UDP.


No, that is different. Actually a socket has two ends: one local and one 
remote. Each has his IP an port number. When you use a socket for listening 
incomming connection, the Addr property is used to specify the interface IP 
address which is used to accept incomming connections, 0.0.0.0 is a special 
case saying the socket to accept connections from any one of the interfaces 
installed in the computer. For an outgoing connection, the localaddr 
property is used to specific the interface to use for having the connection 
going out of the computer while the Addr property is used for the remote 
address.



OK. I have another application where I am using UDP and I set the addr
property to the remote IP address. Then I call connect, use send and
OnDataAvaliable and all works fine.


This is an outgoing socket. That is different than listening. As I saif 
above, for an outgoing (client) socket, the addr property designated the 
remote address to conect to.
UDP is a special case where there is no real connection as you have with 
TCP. To have a universal interface in TWSocket, I use the connect method to 
bind the socket to the parameters given by the properties.




What would be the reason(s) that I am not able to do the same thing with
this new device? Error 10049 says I cannot bind to the remote address.


Because you call listen !


What does the connect call, using UDP, send to the remote that
caused the 10049 on one device and not others? I am so confused. ;)


Me too. I'm not sure I understand your description.

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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...

2010-03-24 Thread zayin
Hi,

 What would be the reason(s) that I am not able to do the same thing with
 this new device? Error 10049 says I cannot bind to the remote address.

Because you call listen !

I am calling Connect.

Using UDP, I have another application, I set the addr property to the remote
IP address, set the port number, call connect, use send to transmit the
bytes and OnDataAvaliable to get the reply and all works fine.  

Now, different remote device, I do the same as the above paragraph and I get
error 10049 when I call connect. I am trying to understand what is causing
the error.

The remote device will not send me any data until I request it. So, I am not
sitting with a port listening for an incoming connection. 

What am I not understanding, in one device I can use UDP/Connect and it
works. Another device I get an error 10049 when I call connect.

I understand why I get the 10049 error on listen. Makes total since.

So, with UDP LocalAddr is not used.

Cheers,

Mark










-Original Message-
From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On
Behalf Of Francois PIETTE
Sent: Wednesday, March 24, 2010 1:49 PM
To: ICS support mailing
Subject: Re: [twsocket] UDP...

 ...originating only from that interface.

 I have done that kind of binding before using LocalAddr. I assume it would
 be the same property for UDP.

No, that is different. Actually a socket has two ends: one local and one 
remote. Each has his IP an port number. When you use a socket for listening 
incomming connection, the Addr property is used to specify the interface IP 
address which is used to accept incomming connections, 0.0.0.0 is a special 
case saying the socket to accept connections from any one of the interfaces 
installed in the computer. For an outgoing connection, the localaddr 
property is used to specific the interface to use for having the connection 
going out of the computer while the Addr property is used for the remote 
address.

 OK. I have another application where I am using UDP and I set the addr
 property to the remote IP address. Then I call connect, use send and
 OnDataAvaliable and all works fine.

This is an outgoing socket. That is different than listening. As I saif 
above, for an outgoing (client) socket, the addr property designated the 
remote address to conect to.
UDP is a special case where there is no real connection as you have with 
TCP. To have a universal interface in TWSocket, I use the connect method to 
bind the socket to the parameters given by the properties.


 What would be the reason(s) that I am not able to do the same thing with
 this new device? Error 10049 says I cannot bind to the remote address.

Because you call listen !

 What does the connect call, using UDP, send to the remote that
 caused the 10049 on one device and not others? I am so confused. ;)

Me too. I'm not sure I understand your description.

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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

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

2008-10-16 Thread brian
Have you checked PeerAddr?

- Original Message - 
From: Xealot [EMAIL PROTECTED]
To: twsocket@elists.org
Sent: Friday, October 17, 2008 04:47
Subject: [twsocket] UDP Address


 Hello!

 I would like to know if its possible to get the address that a UDP packet
 comes from.

 I am making an application that will send multiple packets to different
 hosts using SendTo and I will be receiving replies from them.

 I have no power to change the protocol, so I need to know if its possible 
 to
 find out the address each packet arrived from.

 Currently, I use bytesread := sock.Receive(@data, SizeOf(data));  to 
 receive
 the data.

 where sock is a TWSocket object.  sock.Addr will not work here.. :(

 Thanks for taking your time,

 - Martin E.
 -- 
 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 Address

2008-10-16 Thread Xealot
Thank you for replying,

PeerAddr raises a SocketException

'Error 10057 in function GetPeerName Socket is not connected'

Im assuming this is because I didnt actually run sock.Connect with the
address I received

that packet from?  Im only running sock.connect once to avoid changing
client port

On Fri, Oct 17, 2008 at 4:54 AM, brian [EMAIL PROTECTED] wrote:

 Have you checked PeerAddr?

 - Original Message -
 From: Xealot [EMAIL PROTECTED]
 To: twsocket@elists.org
 Sent: Friday, October 17, 2008 04:47
 Subject: [twsocket] UDP Address


  Hello!
 
  I would like to know if its possible to get the address that a UDP packet
  comes from.
 
  I am making an application that will send multiple packets to different
  hosts using SendTo and I will be receiving replies from them.
 
  I have no power to change the protocol, so I need to know if its possible
  to
  find out the address each packet arrived from.
 
  Currently, I use bytesread := sock.Receive(@data, SizeOf(data));  to
  receive
  the data.
 
  where sock is a TWSocket object.  sock.Addr will not work here.. :(
 
  Thanks for taking your time,
 
  - Martin E.
  --
  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

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

2008-10-16 Thread brian
Maybe GetPeerAddr?

- Original Message - 
From: Xealot [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Friday, October 17, 2008 05:01
Subject: Re: [twsocket] UDP Address


 Thank you for replying,

 PeerAddr raises a SocketException

 'Error 10057 in function GetPeerName Socket is not connected'

 Im assuming this is because I didnt actually run sock.Connect with the
 address I received

 that packet from?  Im only running sock.connect once to avoid changing
 client port

 On Fri, Oct 17, 2008 at 4:54 AM, brian [EMAIL PROTECTED] wrote:

 Have you checked PeerAddr?

 - Original Message -
 From: Xealot [EMAIL PROTECTED]
 To: twsocket@elists.org
 Sent: Friday, October 17, 2008 04:47
 Subject: [twsocket] UDP Address


  Hello!
 
  I would like to know if its possible to get the address that a UDP 
  packet
  comes from.
 
  I am making an application that will send multiple packets to different
  hosts using SendTo and I will be receiving replies from them.
 
  I have no power to change the protocol, so I need to know if its 
  possible
  to
  find out the address each packet arrived from.
 
  Currently, I use bytesread := sock.Receive(@data, SizeOf(data));  to
  receive
  the data.
 
  where sock is a TWSocket object.  sock.Addr will not work here.. :(
 
  Thanks for taking your time,
 
  - Martin E.
  --
  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

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

2008-10-16 Thread Xealot
Hello, Same result.

PeerAddr will invoke the GetPeerAddr function:

property PeerAddr : String read GetPeerAddr;

Thanks for your timeso far.

On Fri, Oct 17, 2008 at 5:25 AM, brian [EMAIL PROTECTED] wrote:

 Maybe GetPeerAddr?

 - Original Message -
 From: Xealot [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Friday, October 17, 2008 05:01
 Subject: Re: [twsocket] UDP Address


  Thank you for replying,
 
  PeerAddr raises a SocketException
 
  'Error 10057 in function GetPeerName Socket is not connected'
 
  Im assuming this is because I didnt actually run sock.Connect with the
  address I received
 
  that packet from?  Im only running sock.connect once to avoid changing
  client port
 
  On Fri, Oct 17, 2008 at 4:54 AM, brian [EMAIL PROTECTED] wrote:
 
  Have you checked PeerAddr?
 
  - Original Message -
  From: Xealot [EMAIL PROTECTED]
  To: twsocket@elists.org
  Sent: Friday, October 17, 2008 04:47
  Subject: [twsocket] UDP Address
 
 
   Hello!
  
   I would like to know if its possible to get the address that a UDP
   packet
   comes from.
  
   I am making an application that will send multiple packets to
 different
   hosts using SendTo and I will be receiving replies from them.
  
   I have no power to change the protocol, so I need to know if its
   possible
   to
   find out the address each packet arrived from.
  
   Currently, I use bytesread := sock.Receive(@data, SizeOf(data));  to
   receive
   the data.
  
   where sock is a TWSocket object.  sock.Addr will not work here.. :(
  
   Thanks for taking your time,
  
   - Martin E.
   --
   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
 
  --
  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

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

2008-10-16 Thread Wilfried Mestdagh
Hello Martin,

Here is a small example:

procedure TFoo.FUDPDataAvailable(Sender: TObject; Error: word);
var
   Buffer: array [0..1023] of char;
   Len: integer;
   Src: TSockAddrIn;
   SrcLen: integer;
begin
   SrcLen := SizeOf(Src);
   Len  := TWSocket(Sender).ReceiveFrom(@Buffer, SizeOf(Buffer), Src, SrcLen);
   if Len  0 then
  Exit;
   Buffer[Len] := #0;

   {$ifdef DEBUG}
  WriteLn('UDP packet received from ', inet_ntoa(Src.sin_addr));
  WriteLn('Data ', Buffer);

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

Friday, October 17, 2008, 04:47, Xealot wrote:

 Hello!

 I would like to know if its possible to get the address that a UDP packet
 comes from.

 I am making an application that will send multiple packets to different
 hosts using SendTo and I will be receiving replies from them.

 I have no power to change the protocol, so I need to know if its possible to
 find out the address each packet arrived from.

 Currently, I use bytesread := sock.Receive(@data, SizeOf(data));  to receive
 the data.

 where sock is a TWSocket object.  sock.Addr will not work here.. :(

 Thanks for taking your time,

  - Martin E.

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

2008-10-16 Thread Xealot
Thank you SO much. I really appreciate it.

 - Martin E.

On Fri, Oct 17, 2008 at 7:37 AM, Wilfried Mestdagh [EMAIL PROTECTED]wrote:

 Hello Martin,

 Here is a small example:

 procedure TFoo.FUDPDataAvailable(Sender: TObject; Error: word);
 var
   Buffer: array [0..1023] of char;
   Len: integer;
   Src: TSockAddrIn;
   SrcLen: integer;
 begin
   SrcLen := SizeOf(Src);
   Len  := TWSocket(Sender).ReceiveFrom(@Buffer, SizeOf(Buffer), Src,
 SrcLen);
   if Len  0 then
  Exit;
   Buffer[Len] := #0;

   {$ifdef DEBUG}
  WriteLn('UDP packet received from ', inet_ntoa(Src.sin_addr));
  WriteLn('Data ', Buffer);

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

 Friday, October 17, 2008, 04:47, Xealot wrote:

  Hello!

  I would like to know if its possible to get the address that a UDP packet
  comes from.

  I am making an application that will send multiple packets to different
  hosts using SendTo and I will be receiving replies from them.

  I have no power to change the protocol, so I need to know if its possible
 to
  find out the address each packet arrived from.

  Currently, I use bytesread := sock.Receive(@data, SizeOf(data));  to
 receive
  the data.

  where sock is a TWSocket object.  sock.Addr will not work here.. :(

  Thanks for taking your time,

   - Martin E.

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

2008-07-22 Thread Francois PIETTE
 This is the first time I am writing a UDP server. The other UDP was a
 client. It was fairly straight forward.

 As the server lets say I have 2 clients, A and B, that will be sending me
 unsolicited data of 100 bytes per message.

 If I understand, when TWSocket.OnDataAvailable fires the data source can 
 be
 mixed.

 For example I could get 10 bytes from A, then 19 bytes from B, then 14 
 bytes
 from B and then 56 bytes from A, etc.
 And I might not get the hundred bytes. I might only get 45.


No, this is wrong. UDP is a datagram protocol. Datagram boundaries are 
respected. If you send 100 bytes (in one call to Send of course), you'll 
receive exactly 100 bytes in one call to Receive done from one 
OnDataAvailable event.

There are a few things you must pay attention: TWSocket.BufSize must be 
large enough for your larger datagram (It default to 1460 bytes); when 
calling Receive or ReceiveFrom (to know who sent the packet), you must pass 
a bufer larger enough; not all physical networks are able to send any 
arbitrary large datagram. There is a limit imposed by each network.

This is totally diffrent for TCP which is a stream protocol.
For a complete description, see TCP/UDP primer document available from my 
website.


--
[EMAIL PROTECTED]
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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 question...

2008-07-22 Thread Francois PIETTE
I think with UDP you get can get packets in different order, not get them 
at
 all, get them repeated.. but as opposed to TCP you get entire packets, if
 you send 100 bytes at once, you get 100 at once. Someone correct me if I'm
 wrong..

You are right.


--
[EMAIL PROTECTED]
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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 question...

2008-07-22 Thread zayin

Thanks for the answer and the link. This has now become a bit easier task.

One last question. The PC has several network cards and the networks are
completely separate.

I need to handle datagrams from all networks. I have a  TWSocket with addr
set to 0.0.0.0 and localAddr is blank. I assume this will allow me to listen
on all networks.

I get the source address using ReceiveFrom and use SendTo to send the
response.

That all sound good?

Thanks,

Mark



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Francois PIETTE
Sent: Tuesday, July 22, 2008 3:13 AM
To: ICS support mailing
Subject: Re: [twsocket] UDP question...

 This is the first time I am writing a UDP server. The other UDP was a 
 client. It was fairly straight forward.

 As the server lets say I have 2 clients, A and B, that will be sending 
 me unsolicited data of 100 bytes per message.

 If I understand, when TWSocket.OnDataAvailable fires the data source 
 can be mixed.

 For example I could get 10 bytes from A, then 19 bytes from B, then 14 
 bytes from B and then 56 bytes from A, etc.
 And I might not get the hundred bytes. I might only get 45.


No, this is wrong. UDP is a datagram protocol. Datagram boundaries are
respected. If you send 100 bytes (in one call to Send of course), you'll
receive exactly 100 bytes in one call to Receive done from one
OnDataAvailable event.

There are a few things you must pay attention: TWSocket.BufSize must be
large enough for your larger datagram (It default to 1460 bytes); when
calling Receive or ReceiveFrom (to know who sent the packet), you must pass
a bufer larger enough; not all physical networks are able to send any
arbitrary large datagram. There is a limit imposed by each network.

This is totally diffrent for TCP which is a stream protocol.
For a complete description, see TCP/UDP primer document available from my
website.


--
[EMAIL PROTECTED]
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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

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

2008-07-22 Thread Francois PIETTE
 Thanks for the answer and the link. This has now become a bit easier task.

 One last question. The PC has several network cards and the networks are
 completely separate.

 I need to handle datagrams from all networks. I have a  TWSocket with addr
 set to 0.0.0.0 and localAddr is blank. I assume this will allow me to 
 listen
 on all networks.

 I get the source address using ReceiveFrom and use SendTo to send the
 response.

 That all sound good?

Yes, very good.

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

2008-07-21 Thread brian
I think with UDP you get can get packets in different order, not get them at 
all, get them repeated.. but as opposed to TCP you get entire packets, if 
you send 100 bytes at once, you get 100 at once. Someone correct me if I'm 
wrong..



 Hi,

 This is the first time I am writing a UDP server. The other UDP was a
 client. It was fairly straight forward.

 As the server lets say I have 2 clients, A and B, that will be sending me
 unsolicited data of 100 bytes per message.

 If I understand, when TWSocket.OnDataAvailable fires the data source can 
 be
 mixed.

 For example I could get 10 bytes from A, then 19 bytes from B, then 14 
 bytes
 from B and then 56 bytes from A, etc.

 And I might not get the hundred bytes. I might only get 45.

 This lead to keeping separate state machines for each client.

 With TCP I normally read the data to the client buffer and post a message 
 so
 that OnDataAvailable is as short as possible. In this case it appears I 
 need
 to read it to a buffer, determine the client, move the data to the clients
 buffer and post a message.


 Sound about right?

 Ciao,

 Mark

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

2008-04-07 Thread Wilfried Mestdagh
Hello zayin,

So first it does not work, then minutes later it works and a little
later same error.

So the explanation is that there is another application that listen on
this ip:port:proto but not all the time.

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

Sunday, April 6, 2008, 19:55, zayin wrote:

 Hi,

Did you try the code that I have posted?

 Yes, copy and paste with:

 ...raised exception ESocketException with message Error 10049 in function
 bind address not available.

 Changing the ip address or port does not change the error. It gives the
 error on the listen.

 Minutes later

 Now after playing with the settings, changing port, ip address etc it works.


 Does not make since.

 Windows firewall did appear for unblocking permission.

 Minutes later

 Now, back to my testing application and changing connect to listen generates
 the same error.

 Going back to connect, all if working again.

 Something I do not understand is going on.


 Ciao,

 Mark




 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On
 Behalf Of Wilfried Mestdagh
 Sent: Sunday, April 06, 2008 12:27 PM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Newbie...

 Hello Mark,

 if you look into source code you see that SendStr call Send, so it is exacly
 the same. I used SendStr just because I was lazy :) I tryed it on a machine
 with an older version of ICS, but it is exacly same result with latest
 version. Did you try the code that I have posted?

 It should work, then try Send or other options.

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

 Sunday, April 6, 2008, 15:34, zayin wrote:


 Hello,

 How about with send and not sendStr?

 That is the only difference I see.

 And what version of ICS are you using?

 Cheers,

 Mark

 

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Wilfried Mestdagh
 Sent: Sunday, April 06, 2008 4:57 AM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Newbie...

 Hello Mark,

 I tryed to do the same as you listen with IP addres of same machine, 
 and when I click the button, 'Hello' is received. This is the complete
 unit:

 unit Unit1;

 interface

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

 type
   TForm1 = class(TForm)
 WSocket1: TWSocket;
 Button1: TButton;
 procedure Button1Click(Sender: TObject);
 procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
 procedure FormCreate(Sender: TObject);
   private
   end;

 var
   Form1: TForm1;

 implementation

 {$R *.dfm}

 procedure TForm1.FormCreate(Sender: TObject); begin
AllocConsole;
 end;

 procedure TForm1.Button1Click(Sender: TObject); begin
WSocket1.Addr := '192.168.0.11';
WSocket1.Port := '47808';
WSocket1.Proto := 'udp';
WSocket1.Listen;
WSocket1.SendStr('Hello');
 end;

 procedure TForm1.WSocket1DataAvailable(Sender: TObject; ErrCode: 
 Word); begin
WriteLn(TWSocket(Sender).ReceiveStr);
 end;

 end.

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


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

2008-04-07 Thread Dave Baxter
If you've not already done so   (Assuming you're using XP)

Make an Exception in Windows Firewall settings, for your application
(exe file name) and the port number it listens on.   Especialy if it
needs to accept incoming data from outside the physical (or virtual) PC.

*Usually* XP's Windows firewall does not affect anything communicating
locally with the Localhost address (127.0.0.1)

But it's a common trip point, when things work locally, but not when
part is running on another PC.

Another hint, use different ports to listen on, and talk with.  That
helps enormously when poth parts of the scheme are on the same physical
PC.

Even if you are trying to communicate between two PC's, their firewall's
only need to know about their Incoming data ports, they will pass
outgoing traffic with no problem.

That relates to XP's own internal (Windows) firewall, in general if you
use something else (instead of, or as well as) it may need to be set to
allow outgoing traffic as well, Zone Alarm is one such, though that
will popup and tell you if something is trying to send stuff to the
internet...

Note!  If you have ZoneAlarm, even if you Disable the ZA firewall at
boot time, it has a habit of blocking everything, as all you disable is
the client, not the service, and it seems if the service is running in
the background, but you've not let the client start, it blocks stuff by
default.  Safe, but so frustrating at times!..

UDP, fun when it works, less so when it doesn't!

 -Original Message-
 From: zayin [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, April 06, 2008 10:06 PM
 To: 'ICS support mailing'
 Subject: Re: [twsocket] UDP Newbie...
 
 
 Hi,
 
 No virus programs. Windows firewall is on.
 
 Thanks for all the help,
 
 Mark
 
  
 
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Wilfried Mestdagh
 Sent: Sunday, April 06, 2008 2:24 PM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Newbie...
 
 Hello Mark,
 
 Do you have virus software or things like that running? If so 
 stop all services. It could be that some virus / firewall 
 software does strange things. Some of those software are very buggy !
 
 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz
 
 Sunday, April 6, 2008, 21:02, zayin wrote:
 
 
  Hi,
 
  The port is not open.
 
  And yes should  is the operative word.
 
  Ciao,
 
  Mark
 
 
 
  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf Of Dod
  Sent: Sunday, April 06, 2008 1:55 PM
  To: ICS support mailing
  Subject: Re: [twsocket] UDP Newbie...
 
  Hello zayin,
 
  I tried same sample as Wilfried and its OK for me.
 
  Are you sure your port was not in use at the time you tried 
 to start 
  the program ?
 
  netstat -an will show you all opened/listening port.
 
  if none is listening on your port then you application 
 should listen.
 
  regards.
 
 Did you try the code that I have posted?
 
 z Yes, copy and paste with:
 
 z ...raised exception ESocketException with message Error 10049 in 
 z function bind address not available.
 
 z Changing the ip address or port does not change the 
 error. It gives 
 z the error on the listen.
 
 z Minutes later
 
 z Now after playing with the settings, changing port, ip 
 address etc 
 z it
  works.
 
 
 z Does not make since.
 
 z Windows firewall did appear for unblocking permission.
 
 z Minutes later
 
 z Now, back to my testing application and changing connect 
 to listen 
 z generates the same error.
 
 z Going back to connect, all if working again.
 
 z Something I do not understand is going on.
 
 
 z Ciao,
 
 z Mark
 
 
 
 
 z -Original Message-
 z From: [EMAIL PROTECTED]
 z [mailto:[EMAIL PROTECTED] On Behalf Of 
 Wilfried Mestdagh
 z Sent: Sunday, April 06, 2008 12:27 PM
 z To: ICS support mailing
 z Subject: Re: [twsocket] UDP Newbie...
 
 z Hello Mark,
 
 z if you look into source code you see that SendStr call 
 Send, so it 
 z is exacly the same. I used SendStr just because I was lazy :) I 
 z tryed it on a machine with an older version of ICS, but 
 it is exacly 
 z same result with latest version. Did you try the code that I have
 posted?
 
 z It should work, then try Send or other options.
 
 z ---
 z Rgds, Wilfried [TeamICS]
 z http://www.overbyte.be/eng/overbyte/teamics.html
 z http://www.mestdagh.biz
 
 z Sunday, April 6, 2008, 15:34, zayin wrote:
 
 
  Hello,
 
  How about with send and not sendStr?
 
  That is the only difference I see.
 
  And what version of ICS are you using?
 
  Cheers,
 
  Mark
 
  
 
  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf Of 
 Wilfried Mestdagh
  Sent: Sunday, April 06, 2008 4:57 AM
  To: ICS support mailing
  Subject: Re: [twsocket] UDP Newbie...
 
  Hello Mark,
 
  I tryed to do the same as you listen with IP addres of 
 same machine, 
  and when I click the button, 'Hello' is received

Re: [twsocket] UDP Newbie...

2008-04-07 Thread zayin

Hi,

While that is a possible explanation it is not the case.

At this point I do not care. If it can happen on this machine it can happen
on a client machine and that is not allowable. Calling connect in place of
listen never fails.

Thanks for your help,

Mark

 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Wilfried Mestdagh
Sent: Monday, April 07, 2008 3:03 AM
To: ICS support mailing
Subject: Re: [twsocket] UDP Newbie...

Hello zayin,

So first it does not work, then minutes later it works and a little later
same error.

So the explanation is that there is another application that listen on this
ip:port:proto but not all the time.

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

Sunday, April 6, 2008, 19:55, zayin wrote:

 Hi,

Did you try the code that I have posted?

 Yes, copy and paste with:

 ...raised exception ESocketException with message Error 10049 in 
 function bind address not available.

 Changing the ip address or port does not change the error. It gives 
 the error on the listen.

 Minutes later

 Now after playing with the settings, changing port, ip address etc it
works.


 Does not make since.

 Windows firewall did appear for unblocking permission.

 Minutes later

 Now, back to my testing application and changing connect to listen 
 generates the same error.

 Going back to connect, all if working again.

 Something I do not understand is going on.


 Ciao,

 Mark




 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Wilfried Mestdagh
 Sent: Sunday, April 06, 2008 12:27 PM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Newbie...

 Hello Mark,

 if you look into source code you see that SendStr call Send, so it is 
 exacly the same. I used SendStr just because I was lazy :) I tryed it 
 on a machine with an older version of ICS, but it is exacly same 
 result with latest version. Did you try the code that I have posted?

 It should work, then try Send or other options.

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

 Sunday, April 6, 2008, 15:34, zayin wrote:


 Hello,

 How about with send and not sendStr?

 That is the only difference I see.

 And what version of ICS are you using?

 Cheers,

 Mark

 

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Wilfried Mestdagh
 Sent: Sunday, April 06, 2008 4:57 AM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Newbie...

 Hello Mark,

 I tryed to do the same as you listen with IP addres of same machine, 
 and when I click the button, 'Hello' is received. This is the 
 complete
 unit:

 unit Unit1;

 interface

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

 type
   TForm1 = class(TForm)
 WSocket1: TWSocket;
 Button1: TButton;
 procedure Button1Click(Sender: TObject);
 procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
 procedure FormCreate(Sender: TObject);
   private
   end;

 var
   Form1: TForm1;

 implementation

 {$R *.dfm}

 procedure TForm1.FormCreate(Sender: TObject); begin
AllocConsole;
 end;

 procedure TForm1.Button1Click(Sender: TObject); begin
WSocket1.Addr := '192.168.0.11';
WSocket1.Port := '47808';
WSocket1.Proto := 'udp';
WSocket1.Listen;
WSocket1.SendStr('Hello');
 end;

 procedure TForm1.WSocket1DataAvailable(Sender: TObject; ErrCode: 
 Word); begin
WriteLn(TWSocket(Sender).ReceiveStr);
 end;

 end.

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


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

2008-04-06 Thread Wilfried Mestdagh
Hello Mark,

I tryed to do the same as you listen with IP addres of same machine, and
when I click the button, 'Hello' is received. This is the complete unit:

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
WSocket1: TWSocket;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
procedure FormCreate(Sender: TObject);
  private
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
   AllocConsole;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
   WSocket1.Addr := '192.168.0.11';
   WSocket1.Port := '47808';
   WSocket1.Proto := 'udp';
   WSocket1.Listen;
   WSocket1.SendStr('Hello');
end;

procedure TForm1.WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
begin
   WriteLn(TWSocket(Sender).ReceiveStr);
end;

end.

---
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://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] UDP Newbie...

2008-04-06 Thread zayin

Hello,

How about with send and not sendStr?

That is the only difference I see.

And what version of ICS are you using?

Cheers,

Mark

 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Wilfried Mestdagh
Sent: Sunday, April 06, 2008 4:57 AM
To: ICS support mailing
Subject: Re: [twsocket] UDP Newbie...

Hello Mark,

I tryed to do the same as you listen with IP addres of same machine, and
when I click the button, 'Hello' is received. This is the complete unit:

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
WSocket1: TWSocket;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
procedure FormCreate(Sender: TObject);
  private
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject); begin
   AllocConsole;
end;

procedure TForm1.Button1Click(Sender: TObject); begin
   WSocket1.Addr := '192.168.0.11';
   WSocket1.Port := '47808';
   WSocket1.Proto := 'udp';
   WSocket1.Listen;
   WSocket1.SendStr('Hello');
end;

procedure TForm1.WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
begin
   WriteLn(TWSocket(Sender).ReceiveStr);
end;

end.

---
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://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 Newbie...

2008-04-06 Thread Wilfried Mestdagh
Hello Mark,

if you look into source code you see that SendStr call Send, so it is
exacly the same. I used SendStr just because I was lazy :) I tryed it on
a machine with an older version of ICS, but it is exacly same result
with latest version. Did you try the code that I have posted?

It should work, then try Send or other options.

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

Sunday, April 6, 2008, 15:34, zayin wrote:


 Hello,

 How about with send and not sendStr?

 That is the only difference I see.

 And what version of ICS are you using?

 Cheers,

 Mark

 

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On
 Behalf Of Wilfried Mestdagh
 Sent: Sunday, April 06, 2008 4:57 AM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Newbie...

 Hello Mark,

 I tryed to do the same as you listen with IP addres of same machine, and
 when I click the button, 'Hello' is received. This is the complete unit:

 unit Unit1;

 interface

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

 type
   TForm1 = class(TForm)
 WSocket1: TWSocket;
 Button1: TButton;
 procedure Button1Click(Sender: TObject);
 procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
 procedure FormCreate(Sender: TObject);
   private
   end;

 var
   Form1: TForm1;

 implementation

 {$R *.dfm}

 procedure TForm1.FormCreate(Sender: TObject); begin
AllocConsole;
 end;

 procedure TForm1.Button1Click(Sender: TObject); begin
WSocket1.Addr := '192.168.0.11';
WSocket1.Port := '47808';
WSocket1.Proto := 'udp';
WSocket1.Listen;
WSocket1.SendStr('Hello');
 end;

 procedure TForm1.WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
 begin
WriteLn(TWSocket(Sender).ReceiveStr);
 end;

 end.

 ---
 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://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 Newbie...

2008-04-06 Thread zayin
Hi,

Did you try the code that I have posted?

Yes, copy and paste with:

...raised exception ESocketException with message Error 10049 in function
bind address not available.

Changing the ip address or port does not change the error. It gives the
error on the listen.

Minutes later

Now after playing with the settings, changing port, ip address etc it works.


Does not make since.

Windows firewall did appear for unblocking permission.

Minutes later

Now, back to my testing application and changing connect to listen generates
the same error.

Going back to connect, all if working again.

Something I do not understand is going on.


Ciao,

Mark




-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Wilfried Mestdagh
Sent: Sunday, April 06, 2008 12:27 PM
To: ICS support mailing
Subject: Re: [twsocket] UDP Newbie...

Hello Mark,

if you look into source code you see that SendStr call Send, so it is exacly
the same. I used SendStr just because I was lazy :) I tryed it on a machine
with an older version of ICS, but it is exacly same result with latest
version. Did you try the code that I have posted?

It should work, then try Send or other options.

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

Sunday, April 6, 2008, 15:34, zayin wrote:


 Hello,

 How about with send and not sendStr?

 That is the only difference I see.

 And what version of ICS are you using?

 Cheers,

 Mark

 

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Wilfried Mestdagh
 Sent: Sunday, April 06, 2008 4:57 AM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Newbie...

 Hello Mark,

 I tryed to do the same as you listen with IP addres of same machine, 
 and when I click the button, 'Hello' is received. This is the complete
unit:

 unit Unit1;

 interface

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

 type
   TForm1 = class(TForm)
 WSocket1: TWSocket;
 Button1: TButton;
 procedure Button1Click(Sender: TObject);
 procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
 procedure FormCreate(Sender: TObject);
   private
   end;

 var
   Form1: TForm1;

 implementation

 {$R *.dfm}

 procedure TForm1.FormCreate(Sender: TObject); begin
AllocConsole;
 end;

 procedure TForm1.Button1Click(Sender: TObject); begin
WSocket1.Addr := '192.168.0.11';
WSocket1.Port := '47808';
WSocket1.Proto := 'udp';
WSocket1.Listen;
WSocket1.SendStr('Hello');
 end;

 procedure TForm1.WSocket1DataAvailable(Sender: TObject; ErrCode: 
 Word); begin
WriteLn(TWSocket(Sender).ReceiveStr);
 end;

 end.

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

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

2008-04-06 Thread Dod
Hello zayin,

I tried same sample as Wilfried and its OK for me.

Are you sure your port was not in use at the time you tried to start
the program ?

netstat -an will show you all opened/listening port.

if none is listening on your port then you application should
listen.

regards.

Did you try the code that I have posted?

z Yes, copy and paste with:

z ...raised exception ESocketException with message Error 10049 in function
z bind address not available.

z Changing the ip address or port does not change the error. It gives the
z error on the listen.

z Minutes later

z Now after playing with the settings, changing port, ip address etc it works.


z Does not make since.

z Windows firewall did appear for unblocking permission.

z Minutes later

z Now, back to my testing application and changing connect to listen generates
z the same error.

z Going back to connect, all if working again.

z Something I do not understand is going on.


z Ciao,

z Mark




z -Original Message-
z From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
z Behalf Of Wilfried Mestdagh
z Sent: Sunday, April 06, 2008 12:27 PM
z To: ICS support mailing
z Subject: Re: [twsocket] UDP Newbie...

z Hello Mark,

z if you look into source code you see that SendStr call Send, so it is exacly
z the same. I used SendStr just because I was lazy :) I tryed it on a machine
z with an older version of ICS, but it is exacly same result with latest
z version. Did you try the code that I have posted?

z It should work, then try Send or other options.

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

z Sunday, April 6, 2008, 15:34, zayin wrote:


 Hello,

 How about with send and not sendStr?

 That is the only difference I see.

 And what version of ICS are you using?

 Cheers,

 Mark

 

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Wilfried Mestdagh
 Sent: Sunday, April 06, 2008 4:57 AM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Newbie...

 Hello Mark,

 I tryed to do the same as you listen with IP addres of same machine, 
 and when I click the button, 'Hello' is received. This is the complete
z unit:

 unit Unit1;

 interface

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

 type
   TForm1 = class(TForm)
 WSocket1: TWSocket;
 Button1: TButton;
 procedure Button1Click(Sender: TObject);
 procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
 procedure FormCreate(Sender: TObject);
   private
   end;

 var
   Form1: TForm1;

 implementation

 {$R *.dfm}

 procedure TForm1.FormCreate(Sender: TObject); begin
AllocConsole;
 end;

 procedure TForm1.Button1Click(Sender: TObject); begin
WSocket1.Addr := '192.168.0.11';
WSocket1.Port := '47808';
WSocket1.Proto := 'udp';
WSocket1.Listen;
WSocket1.SendStr('Hello');
 end;

 procedure TForm1.WSocket1DataAvailable(Sender: TObject; ErrCode: 
 Word); begin
WriteLn(TWSocket(Sender).ReceiveStr);
 end;

 end.

 ---
 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://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
 Visit our website at http://www.overbyte.be


z --
z To unsubscribe or change your settings for TWSocket mailing list please goto
z http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
z 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 Newbie...

2008-04-06 Thread Wilfried Mestdagh
Hello Mark,

Do you have virus software or things like that running? If so stop all
services. It could be that some virus / firewall software does strange
things. Some of those software are very buggy !

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

Sunday, April 6, 2008, 21:02, zayin wrote:


 Hi,

 The port is not open.

 And yes should  is the operative word.

 Ciao,

 Mark



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On
 Behalf Of Dod
 Sent: Sunday, April 06, 2008 1:55 PM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Newbie...

 Hello zayin,

 I tried same sample as Wilfried and its OK for me.

 Are you sure your port was not in use at the time you tried to start the
 program ?

 netstat -an will show you all opened/listening port.

 if none is listening on your port then you application should listen.

 regards.

Did you try the code that I have posted?

z Yes, copy and paste with:

z ...raised exception ESocketException with message Error 10049 in 
z function bind address not available.

z Changing the ip address or port does not change the error. It gives 
z the error on the listen.

z Minutes later

z Now after playing with the settings, changing port, ip address etc it
 works.


z Does not make since.

z Windows firewall did appear for unblocking permission.

z Minutes later

z Now, back to my testing application and changing connect to listen 
z generates the same error.

z Going back to connect, all if working again.

z Something I do not understand is going on.


z Ciao,

z Mark




z -Original Message-
z From: [EMAIL PROTECTED] 
z [mailto:[EMAIL PROTECTED] On Behalf Of Wilfried Mestdagh
z Sent: Sunday, April 06, 2008 12:27 PM
z To: ICS support mailing
z Subject: Re: [twsocket] UDP Newbie...

z Hello Mark,

z if you look into source code you see that SendStr call Send, so it is
z exacly the same. I used SendStr just because I was lazy :) I tryed it
z on a machine with an older version of ICS, but it is exacly same 
z result with latest version. Did you try the code that I have posted?

z It should work, then try Send or other options.

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

z Sunday, April 6, 2008, 15:34, zayin wrote:


 Hello,

 How about with send and not sendStr?

 That is the only difference I see.

 And what version of ICS are you using?

 Cheers,

 Mark

 

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Wilfried Mestdagh
 Sent: Sunday, April 06, 2008 4:57 AM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Newbie...

 Hello Mark,

 I tryed to do the same as you listen with IP addres of same machine,
 and when I click the button, 'Hello' is received. This is the 
 complete
z unit:

 unit Unit1;

 interface

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

 type
   TForm1 = class(TForm)
 WSocket1: TWSocket;
 Button1: TButton;
 procedure Button1Click(Sender: TObject);
 procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
 procedure FormCreate(Sender: TObject);
   private
   end;

 var
   Form1: TForm1;

 implementation

 {$R *.dfm}

 procedure TForm1.FormCreate(Sender: TObject); begin
AllocConsole;
 end;

 procedure TForm1.Button1Click(Sender: TObject); begin
WSocket1.Addr := '192.168.0.11';
WSocket1.Port := '47808';
WSocket1.Proto := 'udp';
WSocket1.Listen;
WSocket1.SendStr('Hello');
 end;

 procedure TForm1.WSocket1DataAvailable(Sender: TObject; ErrCode: 
 Word); begin
WriteLn(TWSocket(Sender).ReceiveStr);
 end;

 end.

 ---
 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://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
 Visit our website at http://www.overbyte.be


z --
z To unsubscribe or change your settings for TWSocket mailing list 
z please goto
z http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
z 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


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

2008-04-06 Thread zayin

Hi,

The port is not open.

And yes should  is the operative word.

Ciao,

Mark



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Dod
Sent: Sunday, April 06, 2008 1:55 PM
To: ICS support mailing
Subject: Re: [twsocket] UDP Newbie...

Hello zayin,

I tried same sample as Wilfried and its OK for me.

Are you sure your port was not in use at the time you tried to start the
program ?

netstat -an will show you all opened/listening port.

if none is listening on your port then you application should listen.

regards.

Did you try the code that I have posted?

z Yes, copy and paste with:

z ...raised exception ESocketException with message Error 10049 in 
z function bind address not available.

z Changing the ip address or port does not change the error. It gives 
z the error on the listen.

z Minutes later

z Now after playing with the settings, changing port, ip address etc it
works.


z Does not make since.

z Windows firewall did appear for unblocking permission.

z Minutes later

z Now, back to my testing application and changing connect to listen 
z generates the same error.

z Going back to connect, all if working again.

z Something I do not understand is going on.


z Ciao,

z Mark




z -Original Message-
z From: [EMAIL PROTECTED] 
z [mailto:[EMAIL PROTECTED] On Behalf Of Wilfried Mestdagh
z Sent: Sunday, April 06, 2008 12:27 PM
z To: ICS support mailing
z Subject: Re: [twsocket] UDP Newbie...

z Hello Mark,

z if you look into source code you see that SendStr call Send, so it is 
z exacly the same. I used SendStr just because I was lazy :) I tryed it 
z on a machine with an older version of ICS, but it is exacly same 
z result with latest version. Did you try the code that I have posted?

z It should work, then try Send or other options.

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

z Sunday, April 6, 2008, 15:34, zayin wrote:


 Hello,

 How about with send and not sendStr?

 That is the only difference I see.

 And what version of ICS are you using?

 Cheers,

 Mark

 

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Wilfried Mestdagh
 Sent: Sunday, April 06, 2008 4:57 AM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Newbie...

 Hello Mark,

 I tryed to do the same as you listen with IP addres of same machine, 
 and when I click the button, 'Hello' is received. This is the 
 complete
z unit:

 unit Unit1;

 interface

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

 type
   TForm1 = class(TForm)
 WSocket1: TWSocket;
 Button1: TButton;
 procedure Button1Click(Sender: TObject);
 procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
 procedure FormCreate(Sender: TObject);
   private
   end;

 var
   Form1: TForm1;

 implementation

 {$R *.dfm}

 procedure TForm1.FormCreate(Sender: TObject); begin
AllocConsole;
 end;

 procedure TForm1.Button1Click(Sender: TObject); begin
WSocket1.Addr := '192.168.0.11';
WSocket1.Port := '47808';
WSocket1.Proto := 'udp';
WSocket1.Listen;
WSocket1.SendStr('Hello');
 end;

 procedure TForm1.WSocket1DataAvailable(Sender: TObject; ErrCode: 
 Word); begin
WriteLn(TWSocket(Sender).ReceiveStr);
 end;

 end.

 ---
 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://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
 Visit our website at http://www.overbyte.be


z --
z To unsubscribe or change your settings for TWSocket mailing list 
z please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
z 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

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

2008-04-06 Thread zayin

Hi,

No virus programs. Windows firewall is on.

Thanks for all the help,

Mark

 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Wilfried Mestdagh
Sent: Sunday, April 06, 2008 2:24 PM
To: ICS support mailing
Subject: Re: [twsocket] UDP Newbie...

Hello Mark,

Do you have virus software or things like that running? If so stop all
services. It could be that some virus / firewall software does strange
things. Some of those software are very buggy !

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

Sunday, April 6, 2008, 21:02, zayin wrote:


 Hi,

 The port is not open.

 And yes should  is the operative word.

 Ciao,

 Mark



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Dod
 Sent: Sunday, April 06, 2008 1:55 PM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Newbie...

 Hello zayin,

 I tried same sample as Wilfried and its OK for me.

 Are you sure your port was not in use at the time you tried to start 
 the program ?

 netstat -an will show you all opened/listening port.

 if none is listening on your port then you application should listen.

 regards.

Did you try the code that I have posted?

z Yes, copy and paste with:

z ...raised exception ESocketException with message Error 10049 in 
z function bind address not available.

z Changing the ip address or port does not change the error. It gives 
z the error on the listen.

z Minutes later

z Now after playing with the settings, changing port, ip address etc 
z it
 works.


z Does not make since.

z Windows firewall did appear for unblocking permission.

z Minutes later

z Now, back to my testing application and changing connect to listen 
z generates the same error.

z Going back to connect, all if working again.

z Something I do not understand is going on.


z Ciao,

z Mark




z -Original Message-
z From: [EMAIL PROTECTED]
z [mailto:[EMAIL PROTECTED] On Behalf Of Wilfried Mestdagh
z Sent: Sunday, April 06, 2008 12:27 PM
z To: ICS support mailing
z Subject: Re: [twsocket] UDP Newbie...

z Hello Mark,

z if you look into source code you see that SendStr call Send, so it 
z is exacly the same. I used SendStr just because I was lazy :) I 
z tryed it on a machine with an older version of ICS, but it is exacly 
z same result with latest version. Did you try the code that I have
posted?

z It should work, then try Send or other options.

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

z Sunday, April 6, 2008, 15:34, zayin wrote:


 Hello,

 How about with send and not sendStr?

 That is the only difference I see.

 And what version of ICS are you using?

 Cheers,

 Mark

 

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Wilfried Mestdagh
 Sent: Sunday, April 06, 2008 4:57 AM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Newbie...

 Hello Mark,

 I tryed to do the same as you listen with IP addres of same machine, 
 and when I click the button, 'Hello' is received. This is the 
 complete
z unit:

 unit Unit1;

 interface

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

 type
   TForm1 = class(TForm)
 WSocket1: TWSocket;
 Button1: TButton;
 procedure Button1Click(Sender: TObject);
 procedure WSocket1DataAvailable(Sender: TObject; ErrCode: Word);
 procedure FormCreate(Sender: TObject);
   private
   end;

 var
   Form1: TForm1;

 implementation

 {$R *.dfm}

 procedure TForm1.FormCreate(Sender: TObject); begin
AllocConsole;
 end;

 procedure TForm1.Button1Click(Sender: TObject); begin
WSocket1.Addr := '192.168.0.11';
WSocket1.Port := '47808';
WSocket1.Proto := 'udp';
WSocket1.Listen;
WSocket1.SendStr('Hello');
 end;

 procedure TForm1.WSocket1DataAvailable(Sender: TObject; ErrCode: 
 Word); begin
WriteLn(TWSocket(Sender).ReceiveStr);
 end;

 end.

 ---
 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://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
 Visit our website at http://www.overbyte.be


z --
z To unsubscribe or change your settings for TWSocket mailing list 
z please goto 
z http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
z 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


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

Re: [twsocket] UDP Newbie...

2008-04-01 Thread Wilfried Mestdagh
Hello Mark,

 If I call listen and then try to send I get an error 10049 (Bind Address not
 available)

Are you sure you filled in the correct IP?

 If I call connect and then send, I see the data at the other end but I do
 not get any response in the DataAvailable callback.

No because of the error in previous paragraph it will not listen.

 If I open a second TWSocket to listen I get a callback.

So that is strange. Do you create all in code or do you have TWSocket
component on your form?  If the latter then I suggest to delete it  and
try with a fresh one. Maybe you have changed some properties and have a
conflikt now.

keep a copy of it to check later what exact was changed !

---
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://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] UDP Newbie...

2008-04-01 Thread Tobias Rapp
 If I call listen and then try to send I get an error 10049 (Bind Address not
 available)
 
 Are you sure you filled in the correct IP?

As an additional note: You can probably set the IP string of the server 
socket to 0.0.0.0 which will listen on all available interfaces. So 
you don't have to find or configure the appropriate local interface address.

Allowing the user of the program to change that interface address is 
helpful, though, as someone might have two network cards built-in 
connected to two different networks and wants to attach your application 
only to one of the networks.

Regards,
Tobias

@@VON Tobias Rapp t.rapp~~noa-audio.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


Re: [twsocket] UDP Newbie...

2008-04-01 Thread zayin
Hello Wilfried,

Are you sure you filled in the correct IP? 

Yes.

Do you create all in code or do you have TWSocket component on your form?

On the form.

I deleted the original component, put a new TWSocket on the form, set the
addr to 192.168.245.2, set the proto to udp, called listen, called Send and
got the bind failure.

Calling connect instead of listen and then send performs without error. I
see the data on the other computer.

So, it appears UDP does require two TWSocket. One to send and one to listen.

Ideas?

Ciao,

Mark
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Wilfried Mestdagh
Sent: Tuesday, April 01, 2008 2:26 AM
To: ICS support mailing
Subject: Re: [twsocket] UDP Newbie...

Hello Mark,

 If I call listen and then try to send I get an error 10049 (Bind 
 Address not
 available)

Are you sure you filled in the correct IP?

 If I call connect and then send, I see the data at the other end but I 
 do not get any response in the DataAvailable callback.

No because of the error in previous paragraph it will not listen.

 If I open a second TWSocket to listen I get a callback.

So that is strange. Do you create all in code or do you have TWSocket
component on your form?  If the latter then I suggest to delete it  and try
with a fresh one. Maybe you have changed some properties and have a conflikt
now.

keep a copy of it to check later what exact was changed !

---
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://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 Newbie...

2008-04-01 Thread Ionut Muntean
Please post your code. I assure you, everything is working great in ICS ...

/ Ionut Muntean

zayin wrote:
 Hello Wilfried,

   
 Are you sure you filled in the correct IP? 
 

 Yes.

   
 Do you create all in code or do you have TWSocket component on your form?
 

 On the form.

 I deleted the original component, put a new TWSocket on the form, set the
 addr to 192.168.245.2, set the proto to udp, called listen, called Send and
 got the bind failure.

 Calling connect instead of listen and then send performs without error. I
 see the data on the other computer.

 So, it appears UDP does require two TWSocket. One to send and one to listen.

 Ideas?

 Ciao,

 Mark
  

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
 Behalf Of Wilfried Mestdagh
 Sent: Tuesday, April 01, 2008 2:26 AM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Newbie...

 Hello Mark,

   
 If I call listen and then try to send I get an error 10049 (Bind 
 Address not
 available)
 

 Are you sure you filled in the correct IP?

   
 If I call connect and then send, I see the data at the other end but I 
 do not get any response in the DataAvailable callback.
 

 No because of the error in previous paragraph it will not listen.

   
 If I open a second TWSocket to listen I get a callback.
 

 So that is strange. Do you create all in code or do you have TWSocket
 component on your form?  If the latter then I suggest to delete it  and try
 with a fresh one. Maybe you have changed some properties and have a conflikt
 now.

 keep a copy of it to check later what exact was changed !

 ---
 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://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 Newbie...

2008-04-01 Thread zayin
Hello,

Please post your code.

CodeGearT DelphiR 2007 for Win32R R2 Version 11.0.2902.10471

ICS 5.25

TWSocket I set

Addr 192.168.245.2
Port 47808
Proto udp

Var
 outBuffer:array[0..128] of byte;

In a button click:

outBuffer[0]:=$01;
outBuffer[1]:=$02;

WSocket1.Listen;
WSocket1.Send(@outBuffer,2);

Ciao,

Mark



Complete unit:

unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, WSocket, ComCtrls, StdCtrls, ExtCtrls, WSocketS;

type
  TForm1 = class(TForm)
Button1: TButton;
WSocket1: TWSocket;
procedure Button1Click(Sender: TObject);
  private
   outBuffer:array[0..128] of byte;
  public
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}


procedure TForm1.Button1Click(Sender: TObject);
begin

 outBuffer[0]:=$01;
 outBuffer[1]:=$02;

 WSocket1.Listen;
 WSocket1.Send(@outBuffer,2);
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


Re: [twsocket] UDP Newbie...

2008-03-31 Thread Wilfried Mestdagh
Hello Mark,

 1. Do I need two TWSocket? One to send and one to listen?

No you set it to Listen, and you can send and receive with the same.

 2. Since this is broadcast, will I receive the data I transmit in the
 OnDataAvaliable callback?

Yes if you broadcast then you send to yourself also. Since UDP is not
reliable it could be possible that you don't receive it yourself,
because while you are sending you are not receiving :)

 3. Lots of computers will be sending data how do I determine the source (IP
 address) of the data in the OnDataAvaliable callback?

Please take a look at ReceiveFrom method.

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

Monday, March 31, 2008, 03:36, zayin wrote:


 Hi,

 I am new to programming for UDP, always used TCP, and I have searched for
 answers to some basic questions without joy. Hopefully there are quick
 questions to answer.

 When using TCP and I am the client I use a TWSocket, connect and use the
 object to send and receive data.

 When using TCP and I am the server I use TWSocketServer to listen and when
 OnClientCreate is called it passes an object of my class derived from
 TWSocketClient and I use the object to send and receive data.

 In most cases I am the client for this new program using UDP. Sometimes
 another program may send unsolicited data.

 1. Do I need two TWSocket? One to send and one to listen?
 2. Since this is broadcast, will I receive the data I transmit in the
 OnDataAvaliable callback?
 3. Lots of computers will be sending data how do I determine the source (IP
 address) of the data in the OnDataAvaliable callback?
 4. Any advice about using UDP?

 Ciao,

 Mark



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

2008-03-31 Thread zayin
Hi Wilfried,

Thanks for the reply.

No you set it to Listen, and you can send and receive with the same.

I am having troubles. 

I set the ip address of the TWSocket (UDP) to the correct address.
(192.168.243.1)

If I call listen and then try to send I get an error 10049 (Bind Address not
available)
If I call connect and then send, I see the data at the other end but I do
not get any response in the DataAvailable callback.
If I open a second TWSocket to listen I get a callback.

My error?

Ciao,

Mark



 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Wilfried Mestdagh
Sent: Monday, March 31, 2008 2:01 AM
To: ICS support mailing
Subject: Re: [twsocket] UDP Newbie...

Hello Mark,

 1. Do I need two TWSocket? One to send and one to listen?

No you set it to Listen, and you can send and receive with the same.

 2. Since this is broadcast, will I receive the data I transmit in the 
 OnDataAvaliable callback?

Yes if you broadcast then you send to yourself also. Since UDP is not
reliable it could be possible that you don't receive it yourself, because
while you are sending you are not receiving :)

 3. Lots of computers will be sending data how do I determine the 
 source (IP
 address) of the data in the OnDataAvaliable callback?

Please take a look at ReceiveFrom method.

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

Monday, March 31, 2008, 03:36, zayin wrote:


 Hi,

 I am new to programming for UDP, always used TCP, and I have searched 
 for answers to some basic questions without joy. Hopefully there are 
 quick questions to answer.

 When using TCP and I am the client I use a TWSocket, connect and use 
 the object to send and receive data.

 When using TCP and I am the server I use TWSocketServer to listen and 
 when OnClientCreate is called it passes an object of my class derived 
 from TWSocketClient and I use the object to send and receive data.

 In most cases I am the client for this new program using UDP. 
 Sometimes another program may send unsolicited data.

 1. Do I need two TWSocket? One to send and one to listen?
 2. Since this is broadcast, will I receive the data I transmit in the 
 OnDataAvaliable callback?
 3. Lots of computers will be sending data how do I determine the 
 source (IP
 address) of the data in the OnDataAvaliable callback?
 4. Any advice about using UDP?

 Ciao,

 Mark



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

2008-03-06 Thread Dave Baxter
I'll take a look.

Cheers.

Dave B.


 -Original Message-
 From: wayne forrest [mailto:[EMAIL PROTECTED] 

 Dave, thank you for all the advice, I will look into all of 
 it for sure,
 
 about the Telnet Application: I recall seeing one at sourceforge.net.
 
 Hope that helps.
This mail has been scanned by Palmer Cook Computer Services Limited.  
www.palmercook.co.uk
-- 
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 Hole Punching

2008-03-06 Thread wayne forrest
http://sourceforge.net/projects/ktelnet

On Thu, Mar 6, 2008 at 7:29 PM, Dave Baxter [EMAIL PROTECTED] wrote:

 I'll take a look.

 Cheers.

 Dave B.


  -Original Message-
  From: wayne forrest [mailto:[EMAIL PROTECTED]

  Dave, thank you for all the advice, I will look into all of
  it for sure,
 
  about the Telnet Application: I recall seeing one at sourceforge.net.
 
  Hope that helps.
 This mail has been scanned by Palmer Cook Computer Services Limited.
 www.palmercook.co.uk
 --
 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




-- 
C: 076 337 4368
T: 021 880 2037
F: 021 880 2530
-- 
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 Hole Punching

2008-03-05 Thread Dave Baxter
H

Probably right, Hamachi run's on full blown Windows (NT based), Linux or
Apple systems.   Guess in principle it could run on something else, but
it's not open source.

Take a look at Tinc.  That is an open source VPN system.  Maybe that
could be adapted to your needs?  http://www.tinc-vpn.org/

I don't know much about the mobile platform arena, but from my own
experiments and other messings, though UDP is easier to program (at
least I find it so) TCP is better at maintaining links, especaily
through multiple routers and firewall's etc.

If you have control of the routers in question, it's not dificult to
manualy setup port forwarding of course, and there is the questionable
UPnP protocol where an Application can do it for itself.  But, that
can also allow some very bad things to happen in regard to network
security.

As you obviously know more about the mobile environment than I do, I'll
bow out now.  But with one question in return...

Do you (or anyone else) know of a generic Telnet client for phones like
the N6110?  It'd be so usefull..

Cheers.

Dave B.


 -Original Message-
 From: wayne forrest [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, March 05, 2008 7:06 AM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Hole Punching
 
 Dave, maybe I as not all that clear on my Specification:
 
 My ICS Clients will be Mobile PHones MIDP2.0, therefor I do 
 not think Hamatchi will work, or would it ?
 
 On Tue, Mar 4, 2008 at 4:10 PM, Dave Baxter [EMAIL PROTECTED] wrote:
 
  NAT Traversal is well documented, but less than easy to 
 make work 
  from scratch
 
  But why bother rolling your own?  Just download and use Hamachi.
  (Google for it)  Even the free one will start automaticaly when 
  Winderz boots, then you have a UDP based secure VPN between 
 2 (or more) sites.
  Just about any LAN type app will run across it.  (Versions for 
  Winders, Linux, and some Apple OSwhatsit type things)
 
  Works very well.  I have no affiliation with Hamachi or 
 LogMeIn, just 
  a very satisfied user of the free version so I can get to my home 
  Win2k desktop securely wherever I am, and leaving no unwanted holes 
  poked in the firewall.
 
  Cheers.
 
  Dave.
 
 
   -Original Message-
   From: JLIST [mailto:[EMAIL PROTECTED]
   Sent: Saturday, February 23, 2008 8:45 AM
   To: ICS support mailing
   Subject: Re: [twsocket] UDP Hole Punching
  
   My understanding is that it works on certain types of NAT 
 firewalls.
   On these NATs, an external port is mapped to an internal IP:Port.
   If this is the case, all packets going to that external 
 port will go 
   to the internet IP:Port.
  
   Making it work is not that simple though, with the difficult part 
   being coordinating two parties that do not talk to each other.
   I'm not sure what's being used in real life solutions but 
 it sounds 
   to me that both A and B have to have very frequent UDP 
   communications with S, or have a TCP connection with S in 
 order to 
   coordinate a hole punching attempt.
  
Isn't the translation state based on the remote peer IP
   address, too?
Then the same translation created for A-S and B-S would not
   work when
you try to connect directly A with B.
  
- Original Message -
From: wayne forrest [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Thursday, February 21, 2008 8:22 PM
Subject: [twsocket] UDP Hole Punching
  
  
Has any one made a UDP Hole puncher with ICS ?
   
Let A and B be the two hosts, each in its own private
   network; N1 and N2
are
the two NAT devices; S is a public server with a
   well-known globally
reachable IP address.
   
   1. A and B each begin a UDP conversation with S; the
   NAT devices N1
   and N2 create UDP translation states and assign
   temporary external port
   numbers
   2. S relays these port numbers back to A and B
   3. A and B contact each others' NAT devices directly on
   the translated
   ports; the NAT devices use the previously created
   translation states
and
   send the packets to A and B
   
If I were to implement the above, is it really that simple?
   
or is there much more to it than that ?
   
Any help appreciated, or alternatives, maybe a plugin /
   generic solution
that can be incorporated.
   
Our current setup is Server on PC behind nat and then
   client on Cell
phone.
   
We will have a lot of users not knowing how to do port 
 forwarding.
  
  
  
  
  This mail has been scanned by Palmer Cook Computer Services Limited.
  www.palmercook.co.uk
  --
  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
 
 
 
 
 --
 C: 076 337 4368
 T: 021 880 2037
 F: 021 880 2530
 
 
This mail has been scanned by Palmer Cook Computer Services Limited.  
www.palmercook.co.uk

Re: [twsocket] UDP Hole Punching

2008-03-04 Thread Dave Baxter
NAT Traversal is well documented, but less than easy to make work
from scratch

But why bother rolling your own?  Just download and use Hamachi.
(Google for it)  Even the free one will start automaticaly when Winderz
boots, then you have a UDP based secure VPN between 2 (or more) sites.
Just about any LAN type app will run across it.  (Versions for Winders,
Linux, and some Apple OSwhatsit type things)

Works very well.  I have no affiliation with Hamachi or LogMeIn, just a
very satisfied user of the free version so I can get to my home Win2k
desktop securely wherever I am, and leaving no unwanted holes poked in
the firewall. 

Cheers.

Dave.


 -Original Message-
 From: JLIST [mailto:[EMAIL PROTECTED] 
 Sent: Saturday, February 23, 2008 8:45 AM
 To: ICS support mailing
 Subject: Re: [twsocket] UDP Hole Punching
 
 My understanding is that it works on certain types of NAT firewalls.
 On these NATs, an external port is mapped to an internal IP:Port.
 If this is the case, all packets going to that external port 
 will go to the internet IP:Port.
 
 Making it work is not that simple though, with the difficult 
 part being coordinating two parties that do not talk to each other.
 I'm not sure what's being used in real life solutions but it 
 sounds to me that both A and B have to have very frequent UDP 
 communications with S, or have a TCP connection with S in 
 order to coordinate a hole punching attempt.
 
  Isn't the translation state based on the remote peer IP 
 address, too? 
  Then the same translation created for A-S and B-S would not 
 work when 
  you try to connect directly A with B.
 
  - Original Message -
  From: wayne forrest [EMAIL PROTECTED]
  To: ICS support mailing twsocket@elists.org
  Sent: Thursday, February 21, 2008 8:22 PM
  Subject: [twsocket] UDP Hole Punching
 
 
  Has any one made a UDP Hole puncher with ICS ?
 
  Let A and B be the two hosts, each in its own private 
 network; N1 and N2
  are
  the two NAT devices; S is a public server with a 
 well-known globally
  reachable IP address.
 
 1. A and B each begin a UDP conversation with S; the 
 NAT devices N1
 and N2 create UDP translation states and assign 
 temporary external port
 numbers
 2. S relays these port numbers back to A and B
 3. A and B contact each others' NAT devices directly on 
 the translated
 ports; the NAT devices use the previously created 
 translation states
  and
 send the packets to A and B
 
  If I were to implement the above, is it really that simple?
 
  or is there much more to it than that ?
 
  Any help appreciated, or alternatives, maybe a plugin / 
 generic solution
  that can be incorporated.
 
  Our current setup is Server on PC behind nat and then 
 client on Cell
  phone.
 
  We will have a lot of users not knowing how to do port forwarding.
 
 
 
 
This mail has been scanned by Palmer Cook Computer Services Limited.  
www.palmercook.co.uk
-- 
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 Hole Punching

2008-03-04 Thread wayne forrest
Dave, maybe I as not all that clear on my Specification:

My ICS Clients will be Mobile PHones MIDP2.0, therefor I do not think
Hamatchi will work, or would it ?

On Tue, Mar 4, 2008 at 4:10 PM, Dave Baxter [EMAIL PROTECTED] wrote:

 NAT Traversal is well documented, but less than easy to make work
 from scratch

 But why bother rolling your own?  Just download and use Hamachi.
 (Google for it)  Even the free one will start automaticaly when Winderz
 boots, then you have a UDP based secure VPN between 2 (or more) sites.
 Just about any LAN type app will run across it.  (Versions for Winders,
 Linux, and some Apple OSwhatsit type things)

 Works very well.  I have no affiliation with Hamachi or LogMeIn, just a
 very satisfied user of the free version so I can get to my home Win2k
 desktop securely wherever I am, and leaving no unwanted holes poked in
 the firewall.

 Cheers.

 Dave.


  -Original Message-
  From: JLIST [mailto:[EMAIL PROTECTED]
  Sent: Saturday, February 23, 2008 8:45 AM
  To: ICS support mailing
  Subject: Re: [twsocket] UDP Hole Punching
 
  My understanding is that it works on certain types of NAT firewalls.
  On these NATs, an external port is mapped to an internal IP:Port.
  If this is the case, all packets going to that external port
  will go to the internet IP:Port.
 
  Making it work is not that simple though, with the difficult
  part being coordinating two parties that do not talk to each other.
  I'm not sure what's being used in real life solutions but it
  sounds to me that both A and B have to have very frequent UDP
  communications with S, or have a TCP connection with S in
  order to coordinate a hole punching attempt.
 
   Isn't the translation state based on the remote peer IP
  address, too?
   Then the same translation created for A-S and B-S would not
  work when
   you try to connect directly A with B.
 
   - Original Message -
   From: wayne forrest [EMAIL PROTECTED]
   To: ICS support mailing twsocket@elists.org
   Sent: Thursday, February 21, 2008 8:22 PM
   Subject: [twsocket] UDP Hole Punching
 
 
   Has any one made a UDP Hole puncher with ICS ?
  
   Let A and B be the two hosts, each in its own private
  network; N1 and N2
   are
   the two NAT devices; S is a public server with a
  well-known globally
   reachable IP address.
  
  1. A and B each begin a UDP conversation with S; the
  NAT devices N1
  and N2 create UDP translation states and assign
  temporary external port
  numbers
  2. S relays these port numbers back to A and B
  3. A and B contact each others' NAT devices directly on
  the translated
  ports; the NAT devices use the previously created
  translation states
   and
  send the packets to A and B
  
   If I were to implement the above, is it really that simple?
  
   or is there much more to it than that ?
  
   Any help appreciated, or alternatives, maybe a plugin /
  generic solution
   that can be incorporated.
  
   Our current setup is Server on PC behind nat and then
  client on Cell
   phone.
  
   We will have a lot of users not knowing how to do port forwarding.
 
 
 
 
 This mail has been scanned by Palmer Cook Computer Services Limited.
 www.palmercook.co.uk
 --
 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




-- 
C: 076 337 4368
T: 021 880 2037
F: 021 880 2530
-- 
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 Hole Punching

2008-02-23 Thread JLIST
My understanding is that it works on certain types of NAT firewalls.
On these NATs, an external port is mapped to an internal IP:Port.
If this is the case, all packets going to that external port will
go to the internet IP:Port.

Making it work is not that simple though, with the difficult part
being coordinating two parties that do not talk to each other.
I'm not sure what's being used in real life solutions but it sounds
to me that both A and B have to have very frequent UDP communications
with S, or have a TCP connection with S in order to coordinate a hole
punching attempt.

 Isn't the translation state based on the remote peer IP address, too? Then
 the same translation created for A-S and B-S would not work when you try to
 connect directly A with B.

 - Original Message - 
 From: wayne forrest [EMAIL PROTECTED]
 To: ICS support mailing twsocket@elists.org
 Sent: Thursday, February 21, 2008 8:22 PM
 Subject: [twsocket] UDP Hole Punching


 Has any one made a UDP Hole puncher with ICS ?

 Let A and B be the two hosts, each in its own private network; N1 and N2
 are
 the two NAT devices; S is a public server with a well-known globally
 reachable IP address.

1. A and B each begin a UDP conversation with S; the NAT devices N1
and N2 create UDP translation states and assign temporary external port
numbers
2. S relays these port numbers back to A and B
3. A and B contact each others' NAT devices directly on the translated
ports; the NAT devices use the previously created translation states
 and
send the packets to A and B

 If I were to implement the above, is it really that simple?

 or is there much more to it than that ?

 Any help appreciated, or alternatives, maybe a plugin / generic solution
 that can be incorporated.

 Our current setup is Server on PC behind nat and then client on Cell
 phone.

 We will have a lot of users not knowing how to do port forwarding.


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

2008-02-21 Thread Florin Vancea
Isn't the translation state based on the remote peer IP address, too? Then
the same translation created for A-S and B-S would not work when you try to
connect directly A with B.

- Original Message - 
From: wayne forrest [EMAIL PROTECTED]
To: ICS support mailing twsocket@elists.org
Sent: Thursday, February 21, 2008 8:22 PM
Subject: [twsocket] UDP Hole Punching


 Has any one made a UDP Hole puncher with ICS ?

 Let A and B be the two hosts, each in its own private network; N1 and N2
are
 the two NAT devices; S is a public server with a well-known globally
 reachable IP address.

1. A and B each begin a UDP conversation with S; the NAT devices N1
and N2 create UDP translation states and assign temporary external port
numbers
2. S relays these port numbers back to A and B
3. A and B contact each others' NAT devices directly on the translated
ports; the NAT devices use the previously created translation states
and
send the packets to A and B

 If I were to implement the above, is it really that simple?

 or is there much more to it than that ?

 Any help appreciated, or alternatives, maybe a plugin / generic solution
 that can be incorporated.

 Our current setup is Server on PC behind nat and then client on Cell
 phone.

 We will have a lot of users not knowing how to do port forwarding.

 Thank you.
 Wayne Forrest.
 -- 
 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

2008-02-06 Thread Dod
Hello Skok,

I don't really know what the problem is but I think you do something
too complicated...

A simple .Send to 255.255.255.255 is enought, then OnDataSent do a .Close

why use a TTimer ?

ST I'm trying to create application that would run on multiple machines. 
ST This application has to know IP addresses of all other machines running 
ST same software.
ST I'm trying to do something like discovery on network. Protocol I decided 
ST to use for discovery is UDP. On mailing list I already saw, that only 
ST one TWSocket component
ST can be used for receiving and sending data. So, I wrote following code 
ST for listening:

ST UDPSocket.Proto :='udp';
ST UDPSocket.Addr :='0.0.0.0';
ST UDPSocket.Port :='1234';
ST UDPSocket.Listen;
ST Timer1.Enabled :=True;

ST and on timer event there is code for sending broadcast data to notofy 
ST others about existence:

ST procedure TForm1.Timer1Timer(Sender: TObject);
ST var
ST   SendTo:TSockAddrIn;
ST   LenSendTo:integer;
ST   Data:string;
ST begin
ST   LenSendTo:=SizeOf(SendTo);
ST   Data:='Test'+#0;
ST   SendTo.sin_port :=htons(1234);
ST   SendTo.sin_addr :=StrToInAddr('255.255.255.255');
ST   SendTo.sin_family :=AF_INET;
ST   UDPSocket.SendTo(SendTo,LenSendTo,@Data[1],Length(Data));
ST end;

ST StrToInAddr is function that I found in mailing list.

ST On receive even I have code from udplistener sample:

ST var
ST Buffer : array [0..1023] of char;
ST Len: Integer;
ST Src: TSockAddrIn;
ST SrcLen : Integer;
ST begin
ST SrcLen := SizeOf(Src);
ST Len:= WSocket.ReceiveFrom(@Buffer, SizeOf(Buffer), Src, SrcLen);
ST if Len = 0 then begin
ST   Buffer[Len] := #0;
ST   listbox1.Items.Add(StrPas(Buffer));
ST end;
ST end;

ST Problem is that sending is ok (no error), but ondataavaliable event 
ST never gets fired, so I'm assuming that nothing is sent.

ST What am I doing wrong.

ST P.S. I have been using ICS for awhile now and I think that this is most 
ST stable component suite for networking. Keep the good work.

ST Regards,

ST Skok Tone

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

2008-02-06 Thread Skok Tone
Well, I'm trying to do server and client UDP with one component. So, if 
I want do receive udp packet from network, I have to do Listen on some 
port, and if I want to send UDP packets, I hava to do Send. But since 
component is already listening, I can send only with SendTo. And this 
sendto must be broadcast.
I'm tyring to combine udplistener and udpsender demos into one component.
Timer is used to notify other machines (same application) in intervals 
thar sender is still alive. I'm not trying to do server-client 
communication. I'm trying to do standalone application that would know 
abount others (same application) over udp.

Dod wrote:
 Hello Skok,

 I don't really know what the problem is but I think you do something
 too complicated...

 A simple .Send to 255.255.255.255 is enought, then OnDataSent do a .Close

 why use a TTimer ?

 ST I'm trying to create application that would run on multiple machines. 
 ST This application has to know IP addresses of all other machines running 
 ST same software.
 ST I'm trying to do something like discovery on network. Protocol I decided 
 ST to use for discovery is UDP. On mailing list I already saw, that only 
 ST one TWSocket component
 ST can be used for receiving and sending data. So, I wrote following code 
 ST for listening:

 ST UDPSocket.Proto :='udp';
 ST UDPSocket.Addr :='0.0.0.0';
 ST UDPSocket.Port :='1234';
 ST UDPSocket.Listen;
 ST Timer1.Enabled :=True;

 ST and on timer event there is code for sending broadcast data to notofy 
 ST others about existence:

 ST procedure TForm1.Timer1Timer(Sender: TObject);
 ST var
 ST   SendTo:TSockAddrIn;
 ST   LenSendTo:integer;
 ST   Data:string;
 ST begin
 ST   LenSendTo:=SizeOf(SendTo);
 ST   Data:='Test'+#0;
 ST   SendTo.sin_port :=htons(1234);
 ST   SendTo.sin_addr :=StrToInAddr('255.255.255.255');
 ST   SendTo.sin_family :=AF_INET;
 ST   UDPSocket.SendTo(SendTo,LenSendTo,@Data[1],Length(Data));
 ST end;

 ST StrToInAddr is function that I found in mailing list.

 ST On receive even I have code from udplistener sample:

 ST var
 ST Buffer : array [0..1023] of char;
 ST Len: Integer;
 ST Src: TSockAddrIn;
 ST SrcLen : Integer;
 ST begin
 ST SrcLen := SizeOf(Src);
 ST Len:= WSocket.ReceiveFrom(@Buffer, SizeOf(Buffer), Src, SrcLen);
 ST if Len = 0 then begin
 ST   Buffer[Len] := #0;
 ST   listbox1.Items.Add(StrPas(Buffer));
 ST end;
 ST end;

 ST Problem is that sending is ok (no error), but ondataavaliable event 
 ST never gets fired, so I'm assuming that nothing is sent.

 ST What am I doing wrong.

 ST P.S. I have been using ICS for awhile now and I think that this is most 
 ST stable component suite for networking. Keep the good work.

 ST Regards,

 ST Skok Tone

   

-- 
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 IP Spoofing Possible with ICS?

2008-01-07 Thread Arno Garrels
JLIST wrote:
 Hello all,
 
 Is it possible to UDP IP spoofing with twsocket component?

The only possibility is to use raw sockets with any component
built around winsock API. You may want to use WinPCap instead 
which allows sending raw packets as well.

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

 

 Not that I'm trying to create a security threat - it's used
 in UDP firewall traversal, commonly used in VOIP apps.
 
 I think I should be able to do it with raw socket but it
 doesn't really work very reliably (and it doesn't work on some
 OS at all) and it's more work to construct the whole IP packet.
 
 It'll be great if it's a feature TWSocket provides for UDP
 sockets.
 
 --
 Best regards,
 Jack
-- 
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


  1   2   >