# Revision history [back]

### Get packet data from packetIn

Hi,

I am sending UDP packets from mininet hosts with some data/payload. How to parse the packetIn in the controller to get the packet data ? I am only able to parse the packet to get UDP headers but not the actual data.

Below is the program that sends UDP packets from mininet hosts

# addressing information of target
PORTNUM = 10000

# enter the data content of the UDP packet as hex
PACKETDATA = 'packet data'

# initialize a socket, think of it as a cable
# SOCK_DGRAM specifies that this is UDP
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)

# connect the socket, think of it as connecting the cable to the address location

# send the command
s.send(PACKETDATA)

# close the socket

Thanks


### Get Unable to get packet data from packetIn

 Hi,

I am sending UDP packets from mininet hosts with some data/payload. How to parse the packetIn in the controller to get the packet data ? I am only able to parse the packet to get UDP headers but not the actual data.

Below is the program that sends UDP packets from mininet hosts

# addressing information of target
PORTNUM = 10000

# enter the data content of the UDP packet as hex
PACKETDATA = 'packet data'

# initialize a socket, think of it as a cable
# SOCK_DGRAM specifies that this is UDP
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)

# connect the socket, think of it as connecting the cable to the address location