-
大小:文件類(lèi)型: .rar金幣: 1下載: 0 次發(fā)布日期: 2023-07-31
- 語(yǔ)言: 其他
- 標(biāo)簽:
資源簡(jiǎn)介
WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)
代碼片段和文件信息
//?Module?Name:?Nbclient.c
//
//?Purpose:
//????This?is?a?NetBIOS?client?application?that?can?interact?with
//????either?of?the?two?server?samples.??The?client?attempts?a
//????connection?to?the?server?on?all?LANA?numbers.?Once?the?first
//????connect?succeeds?all?others?are?cancelled?or?disconnected.
//
//?Compile:
//????cl?-o?Nbclient.exe?Nbclient.c?..\Common\Nbcommon.obj
//???????netapi32.lib?user32.lib
//
//?Command?Line?Options:
//????Nbclient.exe?CLIENT-NAME?SERVER-NAME
//
//????CLIENT-NAME????????The?NetBIOS?name?this?client?registers?as
//????SERVER-NAME????????The?NetBIOS?name?of?the?server?to?connect?to
//
#include?
#include?
#include?
#include?“..\Common\nbcommon.h“
#define?MAX_SESSIONS?????254
#define?MAX_NAMES????????254
#define?MAX_BUFFER???????1024
char????szServerName[NCBNAMSZ];
//
//?Function:?Connect
//
//?Description:
//????Post?an?asynchronous?connect?on?the?given?LANA?number?to
//????the?server.?The?NCB?structure?passed?in?already?has?the?
//????ncb_event?field?set?to?a?valid?Windows?event?handle.?Just
//????fill?in?the?blanks?and?make?the?call.
//
int?Connect(PNCB?pncb?int?lana?char?*server?char?*client)
{
????pncb->ncb_command?=?NCBCALL?|?ASYNCH;
????pncb->ncb_lana_num?=?lana;
????memset(pncb->ncb_name?‘?‘?NCBNAMSZ);
????strncpy(pncb->ncb_name?client?strlen(client));
????memset(pncb->ncb_callname?‘?‘?NCBNAMSZ);
????strncpy(pncb->ncb_callname?server?strlen(server));
????if?(Netbios(pncb)?!=?NRC_GOODRET)
????{
????????printf(“ERROR:?Netbios:?NCBCONNECT:?%d\n“
pncb->ncb_retcode);
????????return?pncb->ncb_retcode;
????}
????return?NRC_GOODRET;
}
//
//?Function:?main
//
//?Description:
//????Initialize?the?NetBIOS?interface?allocate?some?resources
//????(event?handles?a?send?buffer?and?so?on)?and?issue?an?
//????NCBCALL?for?each?LANA?to?the?given?server.?Once?a?connection
//????has?been?made?cancel?or?hang?up?any?other?outstanding
//????connections.?Then?send/receive?the?data.?Finally?clean?
//????things?up.
//
int?main(int?argc?char?**argv)
{
????HANDLE??????*hArray;
????NCB?????????*pncb;
????char?????????szSendBuff[MAX_BUFFER];
????DWORD????????dwBufferLen
?????????????????dwRet
?????????????????dwIndex
?????????????????dwNum;
????LANA_ENUM????lenum;
????int??????????i;
????if?(argc?!=?3)
????{
????????printf(“usage:?nbclient?CLIENT-NAME?SERVER-NAME\n“);
????????return?1;
????}
????//?Enumerate?all?LANAs?and?reset?each?one
????//
????if?(LanaEnum(&lenum)?!=?NRC_GOODRET)
????????return?1;
????if?(ResetAll(&lenum?(UCHAR)MAX_SESSIONS?(UCHAR)MAX_NAMES?
????????????FALSE)?!=?NRC_GOODRET)
????????return?1;
????strcpy(szServerName?argv[2]);
????//
????//?Allocate?an?array?of?HANDLEs?to?use?for?asynchronous?events.
????//?Also?allocate?an?array?of?NCB?structures.??We?need?1?handle
//?and?1?NCB?for?each?LANA?number.
????//
????hArray?=?(HANDLE?*)GlobalAlloc(GMEM_FIX
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件????1688792??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\001.PDF
?????文件?????325212??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\002.PDF
?????文件?????453893??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\003.PDF
?????文件?????959840??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\004.PDF
?????文件?????470599??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\005.PDF
?????文件????1205325??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\006.PDF
?????文件????1564568??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\007.PDF
?????文件????1237327??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\008.PDF
?????文件????1224720??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\009.PDF
?????文件?????685433??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\010.PDF
?????文件????1176145??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\011.PDF
?????文件????1886742??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\012.PDF
?????文件?????904412??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\013.PDF
?????文件????1204931??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\014.PDF
?????文件????1092155??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\015.PDF
?????文件?????941192??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\016.PDF
?????文件?????340887??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\017.PDF
?????文件?????567525??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\018.PDF
?????文件?????189458??2000-10-26?23:51??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\019.PDF
?????文件??????18138??1998-05-28?21:43??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\源碼\AppendixB\iparp\IPArp.Cpp
?????文件??????20480??1999-06-25?18:57??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\源碼\AppendixB\iparp\IpArp.exe
?????文件????????957??1998-05-28?21:43??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\源碼\AppendixB\iparp\IPArp.h
?????文件????????472??1998-05-28?21:43??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\源碼\AppendixB\iparp\Makefile
?????文件???????7108??1998-05-28?21:55??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\源碼\AppendixB\ipchange\IPChange.Cpp
?????文件??????32768??1999-06-25?18:59??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\源碼\AppendixB\ipchange\ipchange.exe
?????文件????????490??1998-05-28?21:55??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\源碼\AppendixB\ipchange\Makefile
?????文件???????7059??1998-05-28?21:56??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\源碼\AppendixB\ipconfig\IPConfig.Cpp
?????文件??????36864??1999-06-25?19:01??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\源碼\AppendixB\ipconfig\ipconfig.exe
?????文件????????490??1998-05-28?21:56??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\源碼\AppendixB\ipconfig\Makefile
?????文件???????6184??1998-05-28?21:57??WINDOWS網(wǎng)絡(luò)編程技術(shù)(PDF)\源碼\AppendixB\iprenew\IPRenew.Cpp
............此處省略493個(gè)文件信息
評(píng)論
共有 條評(píng)論