中介軟體作業

2021-05-23 09:04:43 字數 4097 閱讀 4256

主要檔案的**:

fctrl_client_linux.c

/** this is sample code generated by rpcgen.

* these are only templates and you can use them

* as a guideline for developing your own functions.

*/#include "fctrl.h"

#include

#include

#include

void

fctrl_1(char *host)

//----------

rfopen_1_path = "test.txt";

rfopen_1_mode = "w+";

result_1 = rfopen_1(rfopen_1_path, rfopen_1_mode, clnt);

if (result_1 == (int *) null)

int handle = *result_1;

printf("rfopen result: %d/n", handle);

//----------

rfwrite_1_handle = handle;

rfwrite_1_buff = "this is a test. /n /

this line will be write into remote file.";

rfwrite_1_size = strlen(rfwrite_1_buff);

result_3 = rfwrite_1(rfwrite_1_handle, rfwrite_1_size, rfwrite_1_buff, clnt);

if (result_3 == (u_int *) null)

printf("rfwrite result: %d/n", *result_3);

//---------

result_5 = rfseek_1(handle, 0, seek_set, clnt);

if (result_5 == (int *) null)

printf("rfseek result: %d/n", *result_5);

//---------

struct read_ret * res;

res = rfread_1(handle, 1024, clnt);

if (result_2 == (u_int *) null)

printf("rfread result: [%d]/n%s/n", res->count, res->str);

result_4 = rfclose_1(handle, clnt);

if (result_4 == (int *) null)

printf("rfclose result: %d/n", *result_4);

clnt_destroy (clnt);

}int

main (int argc, char *argv)

host = argv[1];

fctrl_1 (host);

exit (0);

}fctrl_client_windows.c

/** this is sample code generated by rpcgen.

* these are only templates and you can use them

* as a guideline for developing your own functions.

*/#include "fctrl.h"

#include

#include

#include

#pragma comment(lib, "d32-rpc.lib")

void

fctrl_1(char *host)

//----------

rfopen_1_path = "test.txt";

rfopen_1_mode = "w+";

result_1 = rfopen_1(&rfopen_1_path, &rfopen_1_mode, clnt);

if (result_1 == (int *) null)

file_handle = * result_1;

printf("rfopen result: %d/n", file_handle);

//----------

rfwrite_1_handle = file_handle;

rfwrite_1_buff = "this is a test. /n /

this line will be write into remote file.";

rfwrite_1_size = strlen(rfwrite_1_buff);

result_3 = rfwrite_1(&rfwrite_1_handle, &rfwrite_1_size, &rfwrite_1_buff, clnt);

if (result_3 == (u_int *) null)

printf("rfwrite result: %d/n", *result_3);

//---------

offset = 0;

init_pos = seek_set;

result_5 = rfseek_1(&file_handle, &offset, &init_pos, clnt);

if (result_5 == (int *) null)

printf("rfseek result: %d/n", *result_5);

//---------

read_count = 1024;

res = rfread_1(&file_handle, &read_count, clnt);

if (result_2 == (u_int *) null)

printf("rfread result: [%d]/n%s/n", res->count, res->str);

result_4 = rfclose_1(&file_handle, clnt);

if (result_4 == (int *) null)

printf("rfclose result: %d/n", *result_4);

}int

main (int argc, char *argv)

host = argv[1];

fctrl_1 (host);

return 0;

}fctrl_server.c

/** this is sample code generated by rpcgen.

* these are only templates and you can use them

* as a guideline for developing your own functions.

*/#include "fctrl.h"

#include

int *

rfopen_1_svc(char *path, char *mode,struct svc_req *rqstp)

result = (int) file;

printf("call successed!: rfopen(%s, %s) = %d/n", path, mode, result);

return &result;

}read_ret *

rfread_1_svc(int handle, int size,struct svc_req *rqstp)

u_int *

rfwrite_1_svc(int handle, int size, char *buff,struct svc_req *rqstp)

int *

rfclose_1_svc(int handle,struct svc_req *rqstp)

int *

rfseek_1_svc(int handle, long offset, int init_pos,struct svc_req *rqstp)

心得體會:

中介軟體 訊息中介軟體學習總結

冪等 在程式設計中.乙個冪等操作的特點是其任意多次執行所產生的影響均與一次執行的影響相同。冪等函式,或冪等方法,是指可以使用相同引數重複執行,並能獲得相同結果的函式。這些函式 不會影響系統狀態,也不用擔心重複執行會對系統造成改變。例如,getusername 和settrue 函式就是乙個冪等函式....

ASTA中介軟體

幾年前我用mts的時候就聽說asta了,後來我們公司也搞與midas和asta類似的中介軟體tm bso,現在mts昇華到com 我們的tm由於穩定性和效率不夠也夭折了,最近乙個朋友在一家大型物流軟體公司做開發,說還在使用asta,去asta 看看,還活得很健壯,支援delphi2006 soap,...

laravel中介軟體

自定義中介軟體類,只需要定義乙個handler方法即可,然後我們將主要業務邏輯放在該方法中,如果我們在請求處理前執行業務邏輯,那麼 next閉包執行前執行業務邏輯操作 namespace useclosure class beforemiddleware 如果在請求處理後在執行中介軟體業務邏輯,則在...