Hi,

There's a couple of errors in your code.

First, you mixed up the arguments of memcpy. It takes the destination address 
as the first parameter, and source as the. Right now you are just copying 
something random onto your header struct, and then send out this random byte 
array.

Second, the use of strlen(message) in the send call is wrong. The message array 
is never zeroed, so it will report a random length. Using sizeof(struct 
ofp_header) or perhaps header.length would be more straightforward here.
Regards,
Zoltan


From: openflow-discuss-boun...@lists.stanford.edu 
[mailto:openflow-discuss-boun...@lists.stanford.edu] On Behalf Of Eduard Gibert 
Renart
Sent: Monday, January 27, 2014 7:39 PM
To: Andrew Ferguson
Cc: openflow-discuss@lists.stanford.edu
Subject: Re: [openflow-discuss] Openflow packet

Still doesn't work now the message doesn't even appear in the screen when I use 
wireshark, but if I change the size of the char buffer from 10 to 100 then I 
get Unknown Type 59 or 122 (15231B or 3261B) Ver Warning ! Any ideas ?

Respectfully,
Eduard Gibert Renart


On ene 27, 2014, at 12:37 PM, Andrew Ferguson 
<a...@cs.brown.edu<mailto:a...@cs.brown.edu>> wrote:



On Jan 27, 2014, at 12:33 PM, Eduard Gibert Renart 
<edugib...@gmail.com<mailto:edugib...@gmail.com>> wrote:
Yes my architecture is little-endian.  So I need to convert the length and the 
xid like this ?

    struct ofp_header header;
    header.version = OFP_VERSION;
    header.type = OFPT_HELLO;
    header.length = htons(8);
    header.xid = htonl(13);

yes. I haven't tested your code, but the incorrect length could definitely be 
the problem (xid not so much). try it and see!

if you are new to htons and htonl, I suggest this description: 
http://www.beej.us/guide/bgnet/output/html/multipage/ipstructsdata.html#byteorder

from the excellent Beej's Guide to Network Programming, which I also recommend: 
http://www.beej.us/guide/bgnet/


Andrew

_______________________________________________
openflow-discuss mailing list
openflow-discuss@lists.stanford.edu
https://mailman.stanford.edu/mailman/listinfo/openflow-discuss

Reply via email to