Re: [fpc-pascal] raw socket example

2015-11-18 Thread Jeppe Johansen
Here's an example: 
https://github.com/Laksen/fp-ethernet/blob/master/linuxraw.pas


You need to change ifindex obviously, and I can't remember how that was 
found. But it should be relatively easy.


On 11/18/2015 02:47 PM, Xiangrong Fang wrote:

Hi,

I am looking for some examples of writing linux raw socket programs in 
free pascal, anyone had experience on that?


Thanks a lot!
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] raw socket example

2015-11-18 Thread Dmitry Boyarintsev
On Wed, Nov 18, 2015 at 12:45 PM, Daniel Gaspary  wrote:

> Need to change the fpsocket function call.
>
>
> From fpSocket(AF_INET,SOCK_STREAM,0)
> to fpSocket(AF_INET,SOCK_RAW,0);
>
> Is possible that the "0" needs to be changed too.
>

Just keep in mind that reading such socket is tricky.
There's no more IP address (as shown in the example).
The whole protocol stack needs to be handled manually.

I don't think there's any publish FPC raw-socket example.
The easiest way is to find C raw-socket example and port it to pascal.

thanks,
Dmitry
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] raw socket example

2015-11-18 Thread Daniel Gaspary
Need to change the fpsocket function call.


>From fpSocket(AF_INET,SOCK_STREAM,0)
to fpSocket(AF_INET,SOCK_RAW,0);

Is possible that the "0" needs to be changed too.



On Wed, Nov 18, 2015 at 3:20 PM, leledumbo  wrote:
> FPC docs has them:
> http://www.freepascal.org/docs-html/rtl/sockets/fpaccept.html (server)
> http://www.freepascal.org/docs-html/rtl/sockets/fpconnect.html (client)
>
>
>
>
> --
> View this message in context: 
> http://free-pascal-general.1045716.n5.nabble.com/raw-socket-example-tp5723096p5723097.html
> Sent from the Free Pascal - General mailing list archive at Nabble.com.
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] raw socket example

2015-11-18 Thread leledumbo
FPC docs has them:
http://www.freepascal.org/docs-html/rtl/sockets/fpaccept.html (server)
http://www.freepascal.org/docs-html/rtl/sockets/fpconnect.html (client)




--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/raw-socket-example-tp5723096p5723097.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] raw socket example

2015-11-18 Thread Xiangrong Fang
Hi,

I am looking for some examples of writing linux raw socket programs in free
pascal, anyone had experience on that?

Thanks a lot!
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal