MATLAB Answers

0

How to Transfer Image file from server to client using TCP IP ?

Selva Karna さんによって質問されました 2018 年 3 月 31 日
最新アクティビティ Zdenek Kubin さんによって 回答されました 2018 年 6 月 8 日
How to Transfer Image file from server to client using TCP IP ?

  0 件のコメント

サインイン to comment.

1 件の回答

回答者: Zdenek Kubin 2018 年 6 月 8 日

Hi, some time ago I download from this exchange this code:
Server:
data =imread('ngc6543a.jpg');
data=im2double(data);
s = whos('data');
s.size;
s.bytes;
tcpipServer = tcpip('...', 30000, 'NetworkRole', 'Server');
set(tcpipServer, 'OutputBufferSize', s.bytes);
fopen(tcpipServer);
fwrite(tcpipServer, data(:), 'double');
fclose(tcpipServer);
Client:
tcpipClient = tcpip('...',30000);
set(tcpipClient,'InputBufferSize',300000);
set(tcpipClient,'Timeout',5); %Waiting time in seconds to complete read and write operations
fopen(tcpipClient);
get(tcpipClient, 'BytesAvailable');
tcpipClient.BytesAvailable
DataReceived =[];
pause(0.1);
while (get(tcpipClient, 'BytesAvailable') > 0)
tcpipClient.BytesAvailable
rawData = fread(tcpipClient,300000/8,'double');
DataReceived = [DataReceived; rawData];
pause(0.1)
end
fclose(tcpipClient);
delete(tcpipClient);
clear tcpipClient
% ploting
reshapedData = reshape(DataReceived,650,600,3);
imshow(reshapedData)

  0 件のコメント

サインイン to comment.



Translated by