This project is read-only.

Pcap.NET 0.8.0 HTML problem

Jan 25, 2011 at 7:47 PM
Edited Jan 26, 2011 at 7:17 PM

Hi everyone

im trying to use the new HTTP features in the 0.8.0 release , but i cant initialize it

this is my code

Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer { Source = source,//i have the right MAC addresses Destination = destination, }, new IpV4Layer { Source = new IpV4Address("xx.xx.xx.xx"), //i have the right IP addresses Destination = new IpV4Address("xx.xx.xx.xx"), Ttl = 64, Identification = 100, Protocol = IpV4Protocol.Tcp }, new TcpLayer { DestinationPort = 80, SourcePort = 55319, SequenceNumber = any no. // other fields }, new HttpLayer { // it accepts nothing , there is 4 fields but whenever i assign any value to them i get this msg // "Cannot create an instance of the abstract class or interface 'PcapDotNet.Packets.Http.HttpLayer'" }); communicator.SendPacket(packet);
Jan 26, 2011 at 3:11 PM

Hi shamilqais,

The compiler, as usual, is right.

HttpLayer is abstract.

You should use one of the concrete classes that inherit from this class.





Jan 26, 2011 at 7:11 PM
Edited Jan 26, 2011 at 8:22 PM

Boaz thank you so much man , it worked like a charm :)


but i have a small problem , when i send the packet i monitor it with wireshark , the protocol field reads (HTTP) which is good (when i sent the http header as a the tcp's payload before it used to read it as TCP) , but the info field reads "continuation or non-HTTP traffic"

do you know how i can fix that to make wireshark read it as normal HTTP


P.S. im sending an http request with a correct header and fields

Feb 11, 2011 at 11:21 AM

alright , i solved the "continuation or non-HTTP traffic" by adding :

1- a full HTTP header with fields and values (using the HttpHeader class)

2- the HTTP version

3- a server URI

4- a method for the request or reply