- Community Home
- >
- Networking
- >
- Software Defined Networking
- >
- Re: Creating a packet
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2016 01:58 PM
04-12-2016 01:58 PM
Creating a packet
Hello,
I'm able to create a packet like this:
Ethernet etherh = new Ethernet.Builder().srcAddr(smac).dstAddr(dmac).type(EthernetType.IPv4).build();
Ip iph = new Ip.Builder().srcAddr(sip).dstAddr(dip).type(IpType.TCP).build();
Tcp tcph = new Tcp.Builder().dstPort(dport).srcPort(sport).build();
Packet pkt = new Packet(etherh, iph, tcph);
But how can I add tcp data?
Could anybody please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2016 12:26 PM
05-16-2016 12:26 PM
Re: Creating a packet
To add TCP data, you'd likely need to specify the data as an inner "Protocol".
To specify the data as an inner protocol, you'd build a com.hp.util.pkt.UnknownProtocol, using UnknownProtocol.Builder and specifying the raw bytes you want to add in the bytes() method. Then you'd pass that UnknownProtocol to the Packet constructor just after the 'tcph' parameter.