Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Use Named Pipes to Send Chunks of Binary Data Graphic BMP JPG GIF
Here is a crude hack (bugs included at no extra charge) of your script with a simple dice and slice added to illustrate how it might work. With appropriate computer and file names, it worked in very limited testing...
;------------ ; SERVER.WBT ;------------ _FileName = `c:\Clipboard01.jpg` pipename="\\.\pipe\fluggle" timeout = -1 t_StartTime = GetExactTime() IntControl(12,5,0,0,0);terminate quietly notice = StrCat(@CRLF,@CRLF,"[ Press CTRL+BREAK to exit script ]") BoxOpen("Time Server","Initializing - Awaiting connect from Client") WinPlace(10,10,300,150, ``) While @TRUE ; General Server loop pipehandle = PipeServerCreate(pipename,timeout) If pipehandle=="*ERROR*" || pipehandle=="*TIMER*" Then Continue readinfo = PipeServerRead(pipehandle, timeout) If readinfo=="*ERROR*" || readinfo=="*TIMER*" PipeServerClose(pipehandle,0) Continue ; try again EndIf If readinfo == "GET_FILE" bb = BinaryAlloc(FileSize(_FileName)) BinaryRead(bb,_FileName) response = BinaryPeekHex(bb, 0, BinaryEodGet(bb)) nChunks = (StrLen(response)/32767) For x = 0 To nChunks strChunk = StrSub( response,(x*32767)+1 , 32767 ) rslt=PipeServerWrite(pipehandle,strChunk ) Next PipeServerWrite(pipehandle,"DATA_DONE") EndIf rslt=PipeServerWrite(pipehandle,response) t_EndTime = GetExactTime() BoxText(@CRLF:@TAB:`Data sent. Time start [%t_StartTime%] Time End [%t_EndTime%]`) PipeServerClose(pipehandle, timeout) EndWhile Message("Server","Exited") Exit
;------------ ; CLIENT.WBT ;------------ _ServerNetbiosName = `MyComputerName` _FileName = `c:\Clipboard01.jpg` _GraphicsApp = `mspaint.exe` SERVER = _ServerNetbiosName ; Or "." for the local machine pipename = "fluggle" pipepath = StrCat("\\",SERVER,"\pipe\",pipename) querydata = "GET_FILE" timeout = -1 IntControl(12,5,0,0,0);terminate quietly notice = StrCat(@CRLF,@CRLF,"[ Press CTRL+BREAK to exit script ]") BoxOpen("Client","Initializing connection to server...") WinPlace(10,300,300,450,``) While @TRUE pipehandle = PipeClientOpen(pipepath,timeout) If pipehandle=="*ERROR*" Then Message("error #", PipeInfo(0, 0) ) If pipehandle=="*ERROR*" || pipehandle=="*TIMER*" Then Continue ; try again t_Start = GetExactTime() data = "" temp=PipeClientSendRecvData(pipehandle, querydata,timeout) While @TRUE If temp == "DATA_DONE" || temp == _err Then Break data = data:temp BoxText(`Received %_cnt% of %_total%`) _cnt = _cnt + 1 temp=PipeClientSendRecvData(pipehandle, "",timeout) EndWhile t_End = GetExactTime() t_Size = StrLen(data) BoxText(`RECEIVED %t_Size% bytes.`) PipeClientClose(pipehandle) bb = BinaryAlloc(500000) BinaryPokeHex(bb, 0, data) BinaryWrite(bb, _FileName) BinaryFree(bb) Run(_GraphicsApp,_FileName) ;----- Break ;----- EndWhile Message("Client","Exited") Exit
Article ID: W18222
Filename: Use Named Pipes to Send Chunks of Binary Data.txt
File Created: 2011:09:21:10:41:20
Last Updated: 2011:09:21:10:41:20