Good question. Others here may be more knowledgeable about that. Maybe look at other drivers that communicate to devices via ethernet or wifi?
Something like the Broadlink Remote driver may give you something to work with for sending and receiving packets.
You might want to bring this to developer's forum instead of the lounge. I'm sure the more serious developers on here will have more to add on this than I can give.