Created
October 3, 2013 06:22
-
-
Save jgautsch/6805813 to your computer and use it in GitHub Desktop.
sending name to ftp server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
* Interacting with server | |
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ | |
char *file_name = argv[3]; | |
/* First send the length of the file name */ | |
short int file_name_length = strlen(file_name); | |
if (send(sock, &file_name_length, sizeof(file_name_length), 0) <= 0) | |
DieWithError("send() sent a different number of bytes than expected"); | |
/* Next send the actual file name */ | |
// char *file_name = "smallFile.html"; | |
file_name_length = htons(file_name_length); | |
printf("Filename length: %d\n", file_name_length); | |
printf("Filename: %s\n", file_name); | |
if (send(sock, file_name, strlen(file_name), 0) <= 0) | |
DieWithError("second send() failed"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment