Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %Client side:
- ip_address='189.101.243.232';
- tcpipClient = tcpip(ip_address,44000,'NetworkRole','Client');
- set(tcpipClient,'OutputBufferSize',10000);
- set(tcpipClient,'InputBufferSize',10000);
- set(tcpipClient,'Timeout',30);
- set(tcpipClient,'BytesAvailableFcn',@(~,~)disp(char(fread(tcpipClient,tcpipClient.BytesAvailable,'uint8'))'));
- enviar = @(x) fprintf(tcpipClient,'%s\n',x);
- %Server side:
- tcpipServer = tcpip('0.0.0.0',44000,'NetworkRole','Server');
- set(tcpipServer,'OutputBufferSize',10000);
- set(tcpipServer,'InputBufferSize',10000);
- set(tcpipServer,'Timeout',30);
- set(tcpipServer,'BytesAvailableFcn',@(~,~)disp(char(fread(tcpipServer,tcpipServer.BytesAvailable,'uint8'))'));
- enviar = @(x) fprintf(tcpipServer,'%s\n',x);
- %After setting up:
- %Server:
- fopen(tcpipServer);
- flushinput(tcpipClient);
- %Client:
- fopen(tcpipClient);
- flushinput(tcpipClient);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement