diff options
author | sotech117 <michael_foiani@brown.edu> | 2023-09-18 18:52:24 -0400 |
---|---|---|
committer | sotech117 <michael_foiani@brown.edu> | 2023-09-18 18:52:24 -0400 |
commit | 186915db036f06a604883b644e40eaf377aedadf (patch) | |
tree | 919b77b62ab359f53ca836fc3304d04c4f4fa5b1 | |
parent | 8a25dcda67683817ddd55b669111f7dd8e3107ef (diff) |
got it to work, not sure on protocol.
-rwxr-xr-x | c | bin | 35150 -> 35150 bytes | |||
-rw-r--r-- | c.dSYM/Contents/Resources/DWARF/c | bin | 13761 -> 13761 bytes | |||
-rw-r--r-- | client.c | 2 | ||||
-rwxr-xr-x | l | bin | 34654 -> 34654 bytes | |||
-rwxr-xr-x | s | bin | 54558 -> 54494 bytes | |||
-rw-r--r-- | s.dSYM/Contents/Resources/DWARF/s | bin | 21520 -> 21128 bytes | |||
-rwxr-xr-x | snowcast_control | bin | 20992 -> 35165 bytes | |||
-rw-r--r-- | snowcast_control.dSYM/Contents/Info.plist | 20 | ||||
-rw-r--r-- | snowcast_control.dSYM/Contents/Resources/DWARF/snowcast_control | bin | 0 -> 13761 bytes | |||
-rwxr-xr-x | snowcast_server | bin | 25336 -> 35116 bytes | |||
-rw-r--r-- | snowcast_server.dSYM/Contents/Info.plist | 20 | ||||
-rw-r--r-- | snowcast_server.dSYM/Contents/Resources/DWARF/snowcast_server | bin | 0 -> 15573 bytes | |||
-rw-r--r-- | snowcast_server_concurrent.c | 27 |
13 files changed, 50 insertions, 19 deletions
Binary files differ diff --git a/c.dSYM/Contents/Resources/DWARF/c b/c.dSYM/Contents/Resources/DWARF/c Binary files differindex c325e9f..7af6442 100644 --- a/c.dSYM/Contents/Resources/DWARF/c +++ b/c.dSYM/Contents/Resources/DWARF/c @@ -156,7 +156,7 @@ void *reply_thread_routine(void* args) { printf("client: replyType: %d, stringSize: %d\n", buf[0], buf[1]); // print the while buffer by char for (int i = 0; i < recvbytes; i++) { - printf("%d", buf[i]); + printf("%c ", buf[i]); } struct Reply reply; Binary files differBinary files differdiff --git a/s.dSYM/Contents/Resources/DWARF/s b/s.dSYM/Contents/Resources/DWARF/s Binary files differindex 09cab17..feff9cb 100644 --- a/s.dSYM/Contents/Resources/DWARF/s +++ b/s.dSYM/Contents/Resources/DWARF/s diff --git a/snowcast_control b/snowcast_control Binary files differindex 24fe551..1ab5778 100755 --- a/snowcast_control +++ b/snowcast_control diff --git a/snowcast_control.dSYM/Contents/Info.plist b/snowcast_control.dSYM/Contents/Info.plist new file mode 100644 index 0000000..afe5b44 --- /dev/null +++ b/snowcast_control.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> + <dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleIdentifier</key> + <string>com.apple.xcode.dsym.snowcast_control</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>dSYM</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> + </dict> +</plist> diff --git a/snowcast_control.dSYM/Contents/Resources/DWARF/snowcast_control b/snowcast_control.dSYM/Contents/Resources/DWARF/snowcast_control Binary files differnew file mode 100644 index 0000000..76fce35 --- /dev/null +++ b/snowcast_control.dSYM/Contents/Resources/DWARF/snowcast_control diff --git a/snowcast_server b/snowcast_server Binary files differindex 8a4c1cc..444d321 100755 --- a/snowcast_server +++ b/snowcast_server diff --git a/snowcast_server.dSYM/Contents/Info.plist b/snowcast_server.dSYM/Contents/Info.plist new file mode 100644 index 0000000..789e734 --- /dev/null +++ b/snowcast_server.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> + <dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleIdentifier</key> + <string>com.apple.xcode.dsym.snowcast_server</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>dSYM</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> + </dict> +</plist> diff --git a/snowcast_server.dSYM/Contents/Resources/DWARF/snowcast_server b/snowcast_server.dSYM/Contents/Resources/DWARF/snowcast_server Binary files differnew file mode 100644 index 0000000..0123b4a --- /dev/null +++ b/snowcast_server.dSYM/Contents/Resources/DWARF/snowcast_server diff --git a/snowcast_server_concurrent.c b/snowcast_server_concurrent.c index 4387407..110792d 100644 --- a/snowcast_server_concurrent.c +++ b/snowcast_server_concurrent.c @@ -379,33 +379,24 @@ void *select_thread(void *arg) { // update station of user update_user_station(i, ntohs(command.number)); - const char* song_name = station_data[station_num].filePath; - size_t song_name_size = strlen(song_name); // don't add 1, don't want to include the null terminator - struct Announce *announce = malloc(sizeof *announce + song_name_size); + char* file_path = station_data[station_num].filePath; + int len_file_path = strlen(file_path); - printf("song_name: %s\n", song_name); + char *send_buffer = malloc(len_file_path+2); + send_buffer[0] = 3; + send_buffer[1] = len_file_path; - announce->replyType = 3; - announce->songnameSize = song_name_size; + memcpy(send_buffer + 2, file_path, len_file_path); - announce->songname = malloc(song_name_size); - memcpy(announce->songname, song_name, song_name_size); - - // print out all fields on announce on one line - printf("announce: %d %d %s\n", announce->replyType, announce->songnameSize, announce->songname); - - char* send_buffer[sizeof(struct Announce) + song_name_size]; - memcpy(send_buffer, announce, sizeof(struct Announce)); - memcpy(send_buffer+sizeof(struct Announce), song_name, song_name_size); + printf("buffer: %s\n", send_buffer); int bytessent; - if ((bytessent = send(newfd, send_buffer, sizeof(struct Announce) + song_name_size, 0)) == -1) + if ((bytessent = send(newfd, send_buffer, len_file_path + 2, 0)) == -1) perror("send"); // print the number of bytes sent printf("sent %d bytes\n", bytessent); - free(announce->songname); - free(announce); + free(send_buffer); } else { // send back in invalid command |