91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

udp滑動窗口完美實現,,如果想了解怎么用udp實現完美,流量控制 ,超時機制

資源截圖

代碼片段和文件信息

/*?*********************************************************************
??文??件:?Leclient.c
??項??目:?Legend?
??作??者:?余???強
??日??期:?2009-12-24~2010-03-13
??版??權:?Copyright?(C)?2010?Yu?Qiang?(GPL)
?E-mail:?yuembed@126.com
??博??客:?『20065562‘s?Blog』?有水的地方就有余?http://hi.baidu.com/20065562
?***********************************************************************
*/
#include?
#include?
#include? /*?closereadgethostname?*/
#include? /*?gethostbyname?*/
#include? /*?pthread?*/
#include?
#include?
#include?
#include?
#include? /*?inet_addr?*/
#include? /*?htons?...?*/
#include?
#include? /*?gettimeofday?*/

#include?“Leutiles.h“
#include?“Lesendui.h“ /*?sendui_item_status?*/
#include?“Legend.h“
#include?“Lequeue.h“
#include?“Lepool.h“
#include?“Leclient.h“

/*?本地局部變量
?***********************************************************************
?*/
static?void?client_data_sent(void*??stmgr);
static?gint?client_timeout(gpointer?data);


/*?接口函數實現
?***********************************************************************
?*/
/*?清除STMGR結構體?*/
void?stmgr_clean(STMGR*?stmgr)
{
STMGR* manage?=?stmgr;
QNode* node?=?NULL;

pthread_mutex_destroy(&manage->lock);
pthread_cond_destroy(&manage->notfull);
pthread_cond_destroy(&manage->notempty);
pthread_cond_destroy(&manage->nomorethan);
g_free(manage->thaddr);

node?=?manage->queue->front;
while(node?!=?NULL){
pool_back(node->pack);
node?=?node->next;
}
clean(&(manage->queue));

g_free(manage);
}


/*?終止正在發送的文件項?*/
void?client_item_abort(STMGR*??stmgr)
{
STMGR* ???manage?=?stmgr;
PACKAGE*???spack;

socklen_t??addr_len?=?sizeof(struct?sockaddr);
int ???nbrs;

sendui_item_status(manage?STATUS_SABORT);


pthread_cancel(manage->stid); /*?客戶端:2終止數據發送線程?*/
/*?FIXME:怎么終止接收響應線程?*/

spack?=?pkg_new_status();
LG_PACKAGE_STATUS(spack)->status?=?ABORT;

if((nbrs?=?sendto(manage->sockfd?spack?PKG_LENGTH_STATUS?0
??????(struct?sockaddr*)(manage->thaddr)
??????addr_len))?==?-1){
perror(“文件狀態包發送失敗“);
}

gtk_timeout_remove(manage->timer);

/*?清除結構體?*/
stmgr_clean(manage);
}

/*?客戶端?接收線程?*/
void?client_send_thread(void*??stmgr)
{
STMGR* manage???=?(STMGR*)stmgr;
int sockfd; /*?發送文件套接字?*/
PACKAGE* finfor; /*?文件信息包?*/
PACKAGE* data;
QNode* node;
int nbrs; /*?發送數據大小?*/

struct?sockaddr_in svr_addr;?/*?服務器地址信息?*/
struct?sockaddr_in thaddr;
socklen_t addr_len;

char buf[MAX_PACKAGE_SIZE];?/*?接收Legend包緩沖區?*/
char* filename;

int rtt;
struct?timeval start?end;

/*?發送文件名?*/
filename???=?get_name_from_path(manage->file);

finfor?=?pkg_new_finfor();
strcpy(LG_PACKAGE_FINFOR(finfor)->name?filename); /*?設置要傳送的文件名??*/
strcpy(LG_PACKAGE_FINFOR(finfor)->user?manage->user); /*?設置發送者昵稱 ???*/???
LG_PACKAGE_FINFOR(finfor)->size????=?manage->size;? /*?設置文件大小 ???*/
LG_PACKAGE_FINFOR(finfor)->length??=?MAXBUFLEN; /*?設置數據塊大小 ???*/
LG_PACKAGE_FINFO

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2010-03-19?10:16??Legend1.0.0alpha源代碼\
?????目錄???????????0??2010-03-19?10:16??Legend1.0.0alpha源代碼\doc\
?????目錄???????????0??2010-03-19?10:16??Legend1.0.0alpha源代碼\make\
?????文件????????1341??2010-03-02?20:29??Legend1.0.0alpha源代碼\make\builddir.mak
?????文件?????????845??2010-01-14?17:55??Legend1.0.0alpha源代碼\make\common.mak
?????目錄???????????0??2010-03-19?10:16??Legend1.0.0alpha源代碼\make\config\
?????文件????????1542??2010-02-18?10:14??Legend1.0.0alpha源代碼\make\config\generate_conf.pl
?????文件?????????164??2010-02-18?10:10??Legend1.0.0alpha源代碼\make\config\stand_app.cfg
?????文件????????2050??2010-03-04?20:26??Legend1.0.0alpha源代碼\make\ctool.mak
?????文件????????3168??2010-03-02?20:31??Legend1.0.0alpha源代碼\make\default.mak
?????目錄???????????0??2010-03-19?10:16??Legend1.0.0alpha源代碼\make\doc\
?????文件???????34816??2009-09-23?15:55??Legend1.0.0alpha源代碼\make\doc\Makefile??│г╙├║п╩¤?э.doc
?????文件????????1356??2010-02-19?11:02??Legend1.0.0alpha源代碼\make\environment.mak
?????文件????????2046??2010-03-02?20:36??Legend1.0.0alpha源代碼\make\setup.mak
?????文件????????1717??2010-03-02?20:27??Legend1.0.0alpha源代碼\setenv.sh
?????目錄???????????0??2010-03-19?10:16??Legend1.0.0alpha源代碼\src\
?????目錄???????????0??2010-03-19?10:16??Legend1.0.0alpha源代碼\src\config\
?????文件?????????200??2010-03-15?14:38??Legend1.0.0alpha源代碼\src\config\app.cfg
?????文件?????????238??2010-02-11?22:11??Legend1.0.0alpha源代碼\src\config\legend.cfg
?????目錄???????????0??2010-03-19?10:16??Legend1.0.0alpha源代碼\src\data\
?????文件?????????675??2010-03-15?14:38??Legend1.0.0alpha源代碼\src\data\log.dat
?????文件?????????650??2010-03-15?14:38??Legend1.0.0alpha源代碼\src\data\user.dat
?????目錄???????????0??2010-03-19?10:16??Legend1.0.0alpha源代碼\src\gui\
?????目錄???????????0??2010-03-19?10:16??Legend1.0.0alpha源代碼\src\gui\include\
?????文件????????1360??2010-02-18?10:17??Legend1.0.0alpha源代碼\src\gui\include\Lecmd.h
?????文件?????????822??2010-02-09?11:36??Legend1.0.0alpha源代碼\src\gui\include\Lefiniui.h
?????文件?????????517??2010-02-11?13:52??Legend1.0.0alpha源代碼\src\gui\include\Legui.h
?????文件?????????578??2010-03-03?22:29??Legend1.0.0alpha源代碼\src\gui\include\Lehead.h
?????文件?????????588??2010-03-02?18:51??Legend1.0.0alpha源代碼\src\gui\include\Leinfor.h
?????文件?????????620??2010-03-04?20:36??Legend1.0.0alpha源代碼\src\gui\include\Lemenu.h
?????文件?????????991??2010-03-06?15:20??Legend1.0.0alpha源代碼\src\gui\include\Lerecvui.h
............此處省略117個文件信息

評論

共有 條評論