⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transportfile.h

📁 本代码是基于LINUX系统下的
💻 H
字号:
// TransportFile.h: interface for the CTransportFile class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_TRANSPORTFILE_H__73782A55_E8FE_41B6_B161_6065E1A61A70__INCLUDED_)
#define AFX_TRANSPORTFILE_H__73782A55_E8FE_41B6_B161_6065E1A61A70__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <winsock.h>
//#include <iostream.h>
#include <stdio.h>
//#include <fstream.h>
#include <string.h>
 

#define		TRAN_SUCCESS		1	//传输成功
#define		SOCK_WSA_ERR		(-1)	//启动winsock失败
#define		SOCK_CRSOCK_ERR		(-2)	//创建套接字失败
#define		SOCK_BIND_ERR		(-3)	//绑定端口失败
#define		SOCK_LISTEN_ERR		(-4)	//监听失败
#define		SOCK_ACCEPT_ERR		(-5)	//等待连接失败
#define		SOCK_SEND_ERR		(-6)	//发送数据失败
#define		SOCK_CLOSE_ERR		(-7)	//关闭	SOCKET失败
#define		SOCK_RECVE_ERR		(-8)	//接受数据失败
#define		FILE_ERR		(-9)	//文件错误
#define 	Other_ERR		(0)	//其他不明原因

#define SVR_PORT		8439		//服务器端口
#define SEND_BUFFER_SIZE	2048	//每次发送大小

struct Fileinfo
{    
    char		 fileName[50];	//文件名
    int 		 fileBlock;	//文件分块大小
    int 		 BlockNum;	//文件块数量
    unsigned long   	 fileSize;	//文件总大小
};
class CTransportFile  
{
public:
	CTransportFile();
	virtual ~CTransportFile();

	bool GetLocalIP( char caIpAddr[] );
	int FileSend( SOCKET* s ,CString filename );
	void PrintReturn( int nRet);
	long filesize(FILE *stream);
	int ServerSend( CString FileName );

};

#endif // !defined(AFX_TRANSPORTFILE_H__73782A55_E8FE_41B6_B161_6065E1A61A70__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -