Jason - the GNTP library i linked you to also has a UDP implementation built in (so that the sender can use either protocol). check out the growl_udp_notify() and growl_udp_register() functions (they seem to call the mis-named growl_tcp_datagram() function, but if you check out that function, it actually sends on a UDP port). i am not the author of that library, but i seem to remember that at least a few people had successfully used the UDP methods as well. if nothing else, you might glean something from the code or see if it results in any different behavior when ran.
On Jun 28, 2:06 pm, Jason <[email protected]> wrote: > Hmm, okay ... after looking through the Python binding examples as > well as Brian's growl.c source file, I'm wondering if there is > something else wrong that's unrelated to the way I'm packing the data, > i.e., in the data transmission itself ... I was a bit concerned that > maybe there was some odd data-alignment/packing issues with the struct > since doing a sizeof() didn't report back the size I would have > expected, so I resorted to doing data-packing into an allocated char[] > akin to Brian's growl.c source file method. > > That being said, I'm still getting nothing when sending the data to > the host machine ... here is the new code (note I took out the strings > in the data structures since I'm writing the strings directly into the > allocated char[]): > > #define REG_PACKET_SIZE 23 > #define DATA_PACKET_SIZE 62 > > #define MESSAGE "This is a test message" > #define APP_NAME "Network_Test" > #define NOTIFICATION_NAME "Test" > #define IP_ADDR "127.0.0.1" > #define PORT 9887 > > typedef struct reg_message > { > unsigned char version; > unsigned char type; > unsigned short app_name_length; > unsigned char notification_num; > unsigned char default_notification_num; > short notification_length; > char defaults[1]; > > } reg_message; > > typedef struct data_message > { > unsigned char version; > unsigned char type; > unsigned short flags; > unsigned short notification_length; > unsigned short title_length; > unsigned short description_length; > unsigned short application_name_length; > > } data_message; > > char* reg_message_init() > { > reg_message temp; > > temp.version = 1; > temp.type = 4; > temp.app_name_length = htons(strlen(APP_NAME)); > temp.notification_num = 1; > temp.default_notification_num = 1; > temp.notification_length = htons(strlen(NOTIFICATION_NAME)); > temp.defaults[0] = 19; > > char* return_data = (char*)malloc(REG_PACKET_SIZE); > memset(return_data, 0, REG_PACKET_SIZE); > > char* end_of_data = return_data + REG_PACKET_SIZE; > char* pointer = return_data; > > memcpy(pointer, &temp.version, 1); > pointer++; > > memcpy(pointer, &temp.type, 1); > pointer++; > > memcpy(pointer, &temp.app_name_length, 2); > pointer += 2; > > memcpy(pointer, &temp.notification_num, 1); > pointer++; > > memcpy(pointer, &temp.default_notification_num, 1); > pointer++; > > memcpy(pointer, APP_NAME, strlen(APP_NAME)); > pointer += strlen(APP_NAME); > > memcpy(pointer, NOTIFICATION_NAME, strlen(NOTIFICATION_NAME)); > pointer += strlen(NOTIFICATION_NAME); > > memcpy(pointer, &temp.defaults[0], 1); > pointer++; > > assert(pointer == end_of_data); > > return return_data; > > } > > char* data_message_init() > { > data_message temp; > > temp.version = 1; > temp.type = 5; > temp.flags = htons(0); > temp.notification_length = htons(strlen(NOTIFICATION_NAME)); > temp.title_length = htons(strlen(APP_NAME)); > temp.description_length = htons(strlen(MESSAGE)); > temp.application_name_length = htons(strlen(APP_NAME)); > > char* return_data = (char*)malloc(DATA_PACKET_SIZE); > memset(return_data, 0, DATA_PACKET_SIZE); > > char* end_of_data = return_data + DATA_PACKET_SIZE; > char* pointer = return_data; > > memcpy(pointer, &temp.version, 1); > pointer++; > > memcpy(pointer, &temp.type, 1); > pointer++; > > memcpy(pointer, &temp.flags, 2); > pointer += 2; > > memcpy(pointer, &temp.notification_length, 2); > pointer += 2; > > memcpy(pointer, &temp.title_length, 2); > pointer += 2; > > memcpy(pointer, &temp.description_length, 2); > pointer += 2; > > memcpy(pointer, &temp.application_name_length, 2); > pointer += 2; > > memcpy(pointer, NOTIFICATION_NAME, strlen(NOTIFICATION_NAME)); > pointer += strlen(NOTIFICATION_NAME); > > memcpy(pointer, APP_NAME, strlen(APP_NAME)); > pointer += strlen(APP_NAME); > > memcpy(pointer, MESSAGE, strlen(MESSAGE)); > pointer += strlen(MESSAGE); > > memcpy(pointer, APP_NAME, strlen(APP_NAME)); > pointer += strlen(APP_NAME); > > assert(pointer == end_of_data); > > return return_data; > > } > > It shouldn't matter that the strings are ASCII strings, right? I > believe UTF-8 and ASCII are suppose to share the same hex code values > for all values less than 0x80 ... > > The only other thing I can think of is that there is no checksum ... > but again, I believe that using types 4 and 5 should allow me to have > no checksum. > > I do appreciate all the help and pointers from everyone on this. As I > noted earlier, if all of this looks good, then I'm guessing something > must be wrong on the sockets side. > > Thanks again, > > Jason -- You received this message because you are subscribed to the Google Groups "Growl Discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/growldiscuss?hl=en.
