matlab使用TCPIP Server Sockets

xiaoxiao2021-02-28  82

server 与 client 通信:(image)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % server close all;clear all;clc; data =imread('img.jpg'); data=im2double(data); s = whos('data') s.size s.bytes tcpipServer = tcpip('0.0.0.0',30000,'NetworkRole','Server'); set(tcpipServer,'OutputBufferSize',s.bytes); fopen(tcpipServer); fwrite(tcpipServer,data(:),'double'); fclose(tcpipServer); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % client close all;clear all;clc; tcpipClient = tcpip('127.0.0.1',30000,'NetworkRole','Client') set(tcpipClient,'InputBufferSize',4500000); set(tcpipClient,'Timeout',30); fopen(tcpipClient); rawData = fread(tcpipClient,562500,'double'); fclose(tcpipClient); reshapedData = reshape(rawData,375,500,3); imshow(reshapedData) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

matlab借助java类,实现server 与 client 通信:

下载:matlab使用TCP/IP Server Sockets

转载请注明原文地址: https://www.6miu.com/read-33569.html

最新回复(0)