views:

495

answers:

5

I'm a C++ programmer, but my question is about the Delphi network socket library Indy.

Essentially as Microsoft crippled raw sockets with WinXP SP2 so that TCP data cannot be sent over them, does this then also apply to Indy? One of my friends recommended it to me rather then using the WinSock API.

If not, then is the only way to use raw TCP sockets using the WinPCap API?

+1  A: 

Indy works quite well. I use it quite a bit with few problems.

If your looking for more basic socket interaction you could use these other components:

  • TTCPClient
  • TCPServer
  • TClientSocket
  • TServerSocket

All of these components also ship with Delphi.

Don't know about winpcap directly, but I believe there is a delphi wrapper for it. I don't currently know where I've seen it but it shouldn't be hard to find using Google code search.

Ryan J. Mills
Yes but does indy support raw tcp sockets in windows?
max tottenham
Maybe ask yourself : "am I definitely sure I have to use raw sockets ?" Because it really seems to be a big matter to solve (see other answers). You may gain a lot of time if you find a solution that doesn't need raw sockets.
Olivier Pons
+3  A: 

If it doesn't, I know that synapse for Delphi does. The latest version now supports D2009 and it is being actively supported.

skamradt
That doesn't mean much. Indy 10 has 4 files IdRaw*.pas in Core. But some restrictions are imposed by Windows (not all versions though), see "Limitations on Raw Sockets" at http://msdn.microsoft.com/en-us/library/ms740548%28VS.85%29.aspx. Presumably these restrictions are independent of the Delphi library used to call the WinSock API.
mghie
That is correct.
Remy Lebeau - TeamB
Synapse is a very great tool. Moreover if you plan to do mutithreading and blocking sockets on a *big* server ( = handle thousand of connexions) keep in mind that, from my experience, synapse is far more stable than Indy. And far easier to understand and modify the code to fit your needs too :) :)
Olivier Pons
A: 

you should check ICS components

ICS is a free internet component library for all Delphi, C++Builder, BDS and RAD Studio versions (win32). It includes TCP, UDP, raw sockets, clients, servers, as well as many high level protocols such as FTP, SMTP, POP3, NNTP, HTTP and more.

http://www.overbyte.be/

avar
+1  A: 

I would rather prefer synapse over than Indy, it's architecture is more simpler thus easier to understand.

Jaimy Azle
So, does Indy support raw sockets or not?
Rob Kennedy
Yes, it does, but it is subject to OS restrictions on such sockets.
Remy Lebeau - TeamB
+2  A: 

As you can see from the other answers there are a lot of Delphi libraries to simplify network programming. However, AFAIK they all provide a friendlier layer over the WinSock API (on Windows, over the standard socket API on other OSs) and thus are not able to do anything that the WinSock API isn't able to do. In particular they may or may not support raw socket access, but if the OS fails to send data over the socket the libraries will only return errors as well.

For more information about the limitations of raw sockets on most recent Windows OS versions see this MSDN page, in particular the section "Limitations on Raw Sockets". It states quite clearly that

To get around these issues, it may be required to write a Windows network protocol driver (device driver) for the specific network protocol.

Neither of the Delphi network programming libraries comes with its own network protocol driver AFAIK. And neither will help you with permission issues on limited user accounts, or the interference of the Windows Firewall.

As you mention WinPcap in your question you know it is capable of doing what you want. There are Delphi wrappers for it, like Magenta Systems Internet Packet Monitoring Components. However, as a C++ programmer you may be better off to use the library directly from C++, as Delphi adds nothing in regard to the socket programming you want to do. In particular you won't need the extra layer to hide platform differences that some of the Delphi libraries provide, as you will be programming directly against the libpcap API.

mghie