当前位置: 技术问答>linux和unix
socket编程的问题
来源: 互联网 发布时间:2015-04-17
本文导语: 我想通过socket来完成ftp的功能,不知是否可以,有没有人做过,请指点一二 | 你还需要稍微修改一下。 /* tthead.h */ #include #include #include #include #include #include #include #include #include ...
我想通过socket来完成ftp的功能,不知是否可以,有没有人做过,请指点一二
|
你还需要稍微修改一下。
/* tthead.h */
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define max(x,y) ( (x) > (y) ? (x):(y) )
#define MAXSIZE 512
#define FILEEND 4
typedef struct _message_t {
int id;
long msgtype;
char data[MAXSIZE+1];
int datalen;
} MSG;
/*cltdaemon.c*/
#include "tthead.h"
#define RADDR "192.168.11.101"
#define RPORT 7896
MSG msg;
int main( int argc, char **argv )
{
int sockfd = 0, n = 0, fd = 0, r = 0;
pid_t pid = 0;
struct sockaddr_in sin;
int flag = 0, endflag = 0;
struct stat buf;
int filesize = 0;
fd_set rd, wr;
int rround = 0, wround = 0;
int nread = 0, nwrite = 0;
int spacelen; /*!
/* tthead.h */
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define max(x,y) ( (x) > (y) ? (x):(y) )
#define MAXSIZE 512
#define FILEEND 4
typedef struct _message_t {
int id;
long msgtype;
char data[MAXSIZE+1];
int datalen;
} MSG;
/*cltdaemon.c*/
#include "tthead.h"
#define RADDR "192.168.11.101"
#define RPORT 7896
MSG msg;
int main( int argc, char **argv )
{
int sockfd = 0, n = 0, fd = 0, r = 0;
pid_t pid = 0;
struct sockaddr_in sin;
int flag = 0, endflag = 0;
struct stat buf;
int filesize = 0;
fd_set rd, wr;
int rround = 0, wround = 0;
int nread = 0, nwrite = 0;
int spacelen; /*!