Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

sending and receiving data in matlab using UDP object

4,362 views
Skip to first unread message

pckong

unread,
Mar 16, 2008, 12:59:13 AM3/16/08
to
Hi all,

I am doing school project and am getting desperate at this moment. I hope in somewhere you will be able to give me some hints, as soon as possible.

Here is what I got. I need to send data from a PC to the other, they are both running matlab. The data transmission will be done with two sets of wireless network card.

I intended to set the data transmission done in a UDP object. Before I made the attempt, an ad-hoc network has been set up, and it is tested working. Here is some useful network information,
For PC1 (host) the IP address is 192.168.0.100 (not static IP)
For PC2 (client) the IP address is 192.168.0.223 (not static IP)

I made a simple test to try sending data with matlab via port 9090, here is what I did,
In PC1, I try to write an integer array to the client port
u=udp('192.168.0.223', 9090);
fopen(u)
fwrite(u, 1:10);
fclose(u)

In PC2, I try to read the integer array from its port
u=udp('192.168.0.223', 9090);
fopen(u)
A=fread(u, 10);
fclose(u)

But no matter how I try, I cannot retrieve the data. I cannot switch to do the whole network programming in Linux as it is too late for me, and I cannot do it in winsock either as I have written a whole bunch of other programs in matlab already.

Please help.

Yours Sincerely,

Peter

Trent Jarvi

unread,
Mar 17, 2008, 1:34:20 PM3/17/08
to

"pckong" <peter_k...@hotmail.com> wrote in message
news:30237278.1205643583...@nitrogen.mathforum.org...
Hi Peter

You need to bind the local port.

% on 192.168.0.100
u=udp('192.168.0.223', 9090,'LocalPort', 9091);


fopen(u)
fwrite(u, 1:10);
fclose(u)

% on 192.168.0.223
u=udp('192.168.0.100', 9091, 'LocalPort' 9090 );

pckong

unread,
Mar 18, 2008, 10:37:11 PM3/18/08
to
Hello Trend,

Thanks so much for your help.
I just did a few tests, it is working now!!
I wonder what the meaning of 'bind the port' or 'echo udp server' are.

Again, thanks so much.

Peter

Message has been deleted

Trent Jarvi

unread,
Mar 19, 2008, 3:55:43 PM3/19/08
to

"pckong" <peter_k...@hotmail.com> wrote in message
news:30593533.1205907134...@nitrogen.mathforum.org...
> Hello,
>
> I got into some other problems related to the previous one. Previously I
> did the following to bind the UDP local port,

>
> % on 192.168.0.100
> u=udp('192.168.0.223', 9090, 'LocalPort', 9091);
> for m=1:1000
> fopen(u);
> A=ceil(10*rand);
> B=ceil(10*rand+10);
> fwrite(u, A:B, 'uint16');
> end

> fclose(u);
>
> % on 192.168.0.223
> u=udp('192.168.0.100', 9091, 'LocalPort' 9090 );
> fopen(u);
> for m=1:1000
> fread(u, whatsize, 'uint16');
> end
> fclose(u);
>
> The above example will give an error shown,
> Error using ==> icinterface.fopen
> Address already in use: Cannot bind.
>
> If I slow down the speed to write to the port, like

> % on 192.168.0.100
> u=udp('192.168.0.223', 9090, 'LocalPort', 9091);
> for m=1:3
> fopen(u);
> A=ceil(10*rand);
> B=ceil(10*rand+10);
> fwrite(u, A:B, 'uint16');
> end
> fclose(u);
> The error message will be gone.
>
> In that case, is there a speed limit for local port binding? If each UDP
> object is a package, and I need to successively transmit more than 1000
> packages. What is the best way to do it?
>
> The other problem is, when I use fread function, and I do not specify the
> size, like the example above. there will be a warning message. Is that
> possible to use 'fread' function without specifying the size of the
> package?
>
>

Hi Peter

Opening interfaces in a thight loop is an expensive operation. I would
suggest moving the fopen() outside of your loop to avoid problems.

> u=udp('192.168.0.223', 9090, 'LocalPort', 9091);

> fopen(u);
> for m=1:1000
> A=ceil(10*rand);
> B=ceil(10*rand+10);
> fwrite(u, A:B, 'uint16');
> end
> fclose(u);
>

Also note that clear does not destroy interfaces. This can lead to
conflicts.

>> clear u
>> u=instrfindall

UDP Object : UDP-jarvitlinux

Communication Settings
RemotePort: 3030
RemoteHost: foo
Terminator: 'LF'

Communication State
Status: closed
RecordStatus: off

Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0

>> delete(u)
>> instrfindall

ans =

[]

>>

pckong

unread,
Mar 20, 2008, 4:10:23 AM3/20/08
to
Everything is working now. Thanks:-)

Walter Roberson

unread,
Mar 20, 2008, 6:19:57 PM3/20/08
to
In article <30593533.1205907134...@nitrogen.mathforum.org>,
pckong <peter_k...@hotmail.com> wrote:

>In that case, is there a speed limit for local port binding?

Yes, there usually is. At the socket level, sockets are usually
set to "linger" so as to catch packets that might be in transmission
at the time the socket is closed. The relevant socket options
are SO_LINGER and SO_REUSE (which has a slightly different purpose) --
but I do not think you would be able to set or clear these options on
a Matlab generated socket.
--
"I think Walter was a very smart man." -- Gene Autry

pckong

unread,
Mar 21, 2008, 8:22:30 PM3/21/08
to
Hi all,

I have got the other problem regarding to read data from the InputBuffer.

For a UDP object, if the DatagramTerminationMode='on',
then I can do 'fread' to take each individual package. But 'fread' function is limited to read 512 bytes only.

And if I set DatagramTerminationMode='off',
then I can do 'fread' to take as much data in the buffer as I like, but I cannot separate each individual packages. That means I have to manually separate them. But if I lost some data it would be disaster.

Any suggestions would be warmly welcome...

Regards,
Pete

Shanker Keshavdas

unread,
Jul 17, 2008, 10:24:02 AM7/17/08
to
Hi everybody,

I have an additional question. I am a mech engineer and am
very new to MATLAB and computing in general.

My Question is:
Do I need to execute both commands simultaneously on both
computers? If not, how much time gap is permissible between
the two commands? I am using the same code discussed above.

Thanks a great deal
Shanker

Kamyar

unread,
Jul 17, 2008, 11:02:01 AM7/17/08
to
"Shanker Keshavdas" <shankerk...@gmail.remove.this.com>
wrote in message <g5nkm2$a5e$1...@fred.mathworks.com>...

You don't need to run both programs at the same time;
obviously sends data first and read it right after.

you also can specify the timeout easily to wait to complete
a read operation by
u.Timeout = ...; (in sec)

hope this helps,
Kamyar

Kamyar

unread,
Jul 17, 2008, 11:09:01 AM7/17/08
to
pckong <peter_k...@hotmail.com> wrote in message
<8637533.12061453807...@nitrogen.mathforum.org>...


512 is the default value. You can increase it by using the
following command:

u.InputBufferSize = Val;

or

u = udp(..., 'InputBufferSize', Val);

Best,
Kamyar

Shanker Keshavdas

unread,
Jul 18, 2008, 12:04:02 PM7/18/08
to
"Kamyar " <kam...@gmail.com> wrote in message
<g5nmt9$9v1$1...@fred.mathworks.com>...

Thanks Kamyar!
It really helped. And now Im closer to understanding about
UDP. However I still have a problem with sending 2 arrays of
floats one after the other. I am able to send one array but
somehow when I try two it does not work.

Here's the program that sends the array:

is = load('C:\Documents and
Settings\Tothom\Escritorio\Shanker\Wajahat Program\Real
Data\_IS.log');
for(i=1:2)
u = udp('192.168.1.147',9000,'LocalPort',9001);
u.OutputBufferSize = 60000;
u.Timeout = 300;
fopen(u);
fwrite(u,is(i,:),'double');
fclose(u);
delete(u);
end

and the program that receives:

clear all;
for i = 1:2
u1 = udp('192.168.1.147',9001,'LocalPort',9000);
u1.InputBufferSize = 60000;
u1.Timeout = 300;
fopen(u1);
fwrite(u1,8*103,'double');
a2 = fread(u1,8*103,'double')
fclose(u1);
delete(u1);
clear u1;
end

As you can see I have set a sufficient buffer size(It was
30000 and then I changed it to 60000 but no change), and the
timeout is quite high. Now, I run both programs on the same
computer one after the other(reciever than sender, since if
sender is executed first the data may be lost).

As I said earlier it worked perfectly on just one row of the
matrix. About the matrix, it has 103 columns is of double type.

Is it possible for you to help me on this? I ask because you
were able to solve the problem well on the previous question.

Thanks in advance :)

Shanker

Shanker Keshavdas

unread,
Jul 18, 2008, 12:04:02 PM7/18/08
to
"Kamyar " <kam...@gmail.com> wrote in message
<g5nmt9$9v1$1...@fred.mathworks.com>...

Thanks Kamyar!

Kamyar

unread,
Jul 19, 2008, 1:07:01 PM7/19/08
to
"Shanker Keshavdas" <shankerk...@gmail.remove.this.com>
wrote in message <g5qeti$dn7$1...@fred.mathworks.com>...


Shanker,

Don't open and close the udp object inside the loop:

is = load('...');


u = udp('192.168.1.147',9000,'LocalPort',9001);

u.OutputBufferSize = ...;
u.Timeout = ...;
fopen(u);
for i=1:2
fwrite(u,is(i,:),'double');
end
fclose(u);
delete(u);

same for reading process; let me know if it doesn't work.

Kamyar

Shanker Keshavdas

unread,
Jul 22, 2008, 9:29:03 AM7/22/08
to

> Shanker,
>
> Don't open and close the udp object inside the loop:
>
> is = load('...');
> u = udp('192.168.1.147',9000,'LocalPort',9001);
> u.OutputBufferSize = ...;
> u.Timeout = ...;
> fopen(u);
> for i=1:2
> fwrite(u,is(i,:),'double');
> end
> fclose(u);
> delete(u);
>
> same for reading process; let me know if it doesn't work.
>
> Kamyar

Thanks Kamyar!

It did work!!

Thanks a lot. :)

jerry adolpher

unread,
May 6, 2009, 3:09:02 PM5/6/09
to
sorry to hijack this thread, but i have a related question. i have an instrument that is supposedly sending out a file via udp, and i can connect this instrument to my computer running matlab using a LAN cable. how am i able to use matlab code to receive this file, in its 'native' file format? i have something basic like this right now:

u1=udp('10.0.0.2') % the ip address of my lan connection
set(u1,'InputBufferSize',3000000)
set(u1,'Timeout',10)

fopen(u1)
fscanf(u1)

fclose(u1)

but im not sure how to write (fwrite?) the received data such that i get back the file being sent. is that possible? and what units of time is the timeout in? thank you so so much!

Jerry

"Shanker Keshavdas" <shankerk...@gmail.remove.this.com> wrote in message <g64nav$l4v$1...@fred.mathworks.com>...

Ankit Desai

unread,
May 15, 2009, 12:30:04 AM5/15/09
to
"jerry adolpher" <hongyouni...@gmail.com> wrote in message <gtsn8e$1to$1...@fred.mathworks.com>...

Assuming that you are already getting the file contents (data) via fscanf, you can use MATLAB's fprintf: http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/fprintf.html&http://www.google.com/search?client=safari&rls=en-us&q=fprintf+matlab&ie=UTF-8&oe=UTF-8

or fwrite: http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/fwrite.html&http://www.google.com/search?client=safari&rls=en-us&q=fwrite+matlab&ie=UTF-8&oe=UTF-8

Depending on the data type.

Timeout is in seconds for instrument control objects - including UDP objects.

Hope this helps.

-Ankit

Anuradha

unread,
Dec 3, 2009, 1:35:03 AM12/3/09
to
pckong <peter_k...@hotmail.com> wrote in message <5548092.12058942622...@nitrogen.mathforum.org>...

I also tried this out.
But it doesnot worked for me. :(

Here are the matlab warnings i received

Warning: The specified amount of data was not returned within the Timeout period.

A =

Empty matrix: 1-by-0


I would be glad if some body can help me.

I want to read Machine B's udp port from machine A. That's all i need.

Hoping a soon reply.

Thank you.

Anuradha

unread,
Dec 3, 2009, 1:36:03 AM12/3/09
to
pckong <peter_k...@hotmail.com> wrote in message <5548092.12058942622...@nitrogen.mathforum.org>...

I also tried this out.

Noman

unread,
Feb 27, 2010, 11:47:03 AM2/27/10
to
My transmitter code is:

u1=udp('192.168.1.55', 9091,'LocalPort', 9090);
set(u1, 'OutputBufferSize', 8192)
set(u1, 'TimeOut', 10)
fopen(u1)
get(u1, 'Status')
while(1)
fwrite(u1, ubuffer(1,:), 'double'); %ubuffer is of size 1x1024
end
fclose(u1)
delete(u1)

My receiver code is:

u=udp('192.168.1.166', 9090, 'LocalPort', 9091, 'InputBufferSize', 8192, 'TimeOut', 10);
fopen(u);
while(1)
[a,count]= fread(u, 1024, 'double');
end
fclose(u)
delete(u)

My problem is that as soon as i increase the number of elements transmitted past 64, i can only receive 64 elements at receiver. Like if i transmit 1x1024 element array, at receiver i get first 64 elements only. Like at this line of code at receiver:

[a,count]= fread(u, 1024, 'double');

i only get 'a' of size 64x1, although i should get 1024x1 size of 'a'. The value of count is also 64, it should be 1024.

To rectify this i have to use a loop and make a 2d array at receiver like 64x16 for 1024 element transmitted array. Also i get a warning "The specified amount of data was not returned in time" after reading every 64 elements. Is there any solution to receive all elements like 1024 in one go??? like i dont have to use loop just
[a,count]= fread(u, 1024, 'double');
and i get all the transmitted elements.

My second problem is that i cannot transmit complex numbers using UDP. I transmit 3 complex numbers and at receiver i only get real part of these complex numbers. Any ideas????

Noman

unread,
Feb 27, 2010, 11:47:03 AM2/27/10
to

cpp.matlab

unread,
Mar 21, 2010, 12:35:56 PM3/21/10
to
Use real(Z) and Imag(Z).
Split one complex number into two numbers and send via UDP.

Best...

> My second problem is that i cannot transmit complex numbers usingUDP. I transmit 3 complex numbers and at receiver i only get real part of these complex numbers. Any ideas????

Nam Tran

unread,
Nov 23, 2010, 10:53:03 AM11/23/10
to
Hi all,
i'm working on a project and i want to use UDP to collect data from a microcontroller (MC) then do the calculation in Matlab.

I used the code as above but i can only send a UDP message to the MC, but i cannt not receive the reply UDP message. I used Wireshark to monitor the traffic and it showed that there were 2 messages: one from matlab and the other from the MC.

Message of matlab : source port 9004, des port : 9005,
source IP : my PC-IP, des IP: MC-IP
Message of MC : source port 9005, des port : 9004
source IP: MC-IP, des IP: my PC-IP
there was no error regards checksum or malformat.

My code is:

re_port = 9005;
lo_port = 9004;

lan_con = udp('144.37.155.160',re_port); % MC IP: 144.37.155.160
lan_con.LocalPort = lo_port;
lan_con.InputBufferSize = 3072;
lan_con.TimeOut = 5; %Time out in seconds

fopen(lan_con);
all_con = instrfindall
% fwrite(lan_con,127);
fprintf(lan_con,'hello world MPC AB')

% fscanf(lan_con,'char')
fread(lan_con,'char')

fclose(lan_con);
delete(lan_con);
clear(lan_con)
(the MC just act like a echo server and send back 'hello world MPC AB')

And anybody know how to clear the used port ? I tried to run the code 2 or more time, matlab always said: "port already used, cannt not bind", so i have to change the ports every time.

Any help would be nice.
Thank u all.

Noman

unread,
Nov 23, 2010, 1:07:04 PM11/23/10
to
The port remains open thats why you are receiving that message. It means your program is not reaching fclose() statement or statements below it. Use debugger to check till which line your program runs. Other method is shutting down matlab and then opening it up again and then run the code again. I suggest running MC and Matlab in Half Duplex mode. First only send packet from Matlab to MC then close the port. Afterwards open the port again and receive packets from MC, i think it will work.

"Nam Tran " <nap...@htwg-konstanz.de> wrote in message <icgo0v$jt1$1...@fred.mathworks.com>...

Nam Tran

unread,
Nov 25, 2010, 12:47:04 PM11/25/10
to
"Noman " <m.neman...@live.com> wrote in message <icgvs8$sjl$1...@fred.mathworks.com>...

> The port remains open thats why you are receiving that message. It means your program is not reaching fclose() statement or statements below it. Use debugger to check till which line your program runs. Other method is shutting down matlab and then opening it up again and then run the code again. I suggest running MC and Matlab in Half Duplex mode. First only send packet from Matlab to MC then close the port. Afterwards open the port again and receive packets from MC, i think it will work.


Hi Noman,
thank for ur answer, but matlab still cannt receice any package from the MC.
The MC send every 3 secs a UDP and matlab works passive as receiver but it couldnt receive anything. I tried the RX code with a PC-PC connection and it worked.
Is there a different between a UDP package from MC and UDP package from PC???

Noman

unread,
Nov 26, 2010, 5:25:04 AM11/26/10
to
I had same problems when i worked with FPGA-Computer. Tell me, are you creating packet at MC like adding MAC address, IP address, header of UDP and then data fields. if yes, then the MAC address of MC needs to be in the ARP table of your computer. For this, you need to make a static entry into arp table. This is done by using command 'arp -s IP-of-MC MAC-of-MC' on command prompt. Please check the correct format of entering arp entry from internet.

"Nam Tran " <nap...@htwg-konstanz.de> wrote in message <icm7eo$8ju$1...@fred.mathworks.com>...

Nam Tran

unread,
Nov 26, 2010, 6:28:06 AM11/26/10
to
"Noman " <m.neman...@live.com> wrote in message <ico1u0$qm3$1...@fred.mathworks.com>...

Hi Noman,

thank for ur answer. Regarding the ARP i already have a auto ARP-Reply on Request, so the MAC of MC is registed in ARP-Table.
I have figured out, that the problem was checksum of UDP-Package. I set the UDP-Checksum to 0x0000(none) and it worked. (dont know why???)

Thank u for ur time.
Best wish.
Nam Tran

Noman

unread,
Nov 28, 2010, 9:04:06 AM11/28/10
to
The reason is that in UDP, check-sum is optional. You can either fill that field with appropriate value or 0x0000. In TCP , check-sum is necessary. If check-sum was wrong, the wireshark do show that there is a problem with the packet being received usually marked as red.

"Nam Tran " <nap...@htwg-konstanz.de> wrote in message <ico5k6$l93$1...@fred.mathworks.com>...

Abdul

unread,
Jun 10, 2012, 6:40:09 AM6/10/12
to
pckong <peter_k...@hotmail.com> wrote in message <5548092.12058942622...@nitrogen.mathforum.org>...
> Hello Trend,
>
> Thanks so much for your help.
> I just did a few tests, it is working now!!
> I wonder what the meaning of 'bind the port' or 'echo udp server' are.
>
> Again, thanks so much.
>
> Peter


peter u said that we need to blind the local port how can i do this ...i cannt understand this .... can u explain me this .....

Nasser M. Abbasi

unread,
Jun 10, 2012, 6:51:09 AM6/10/12
to
On 6/10/2012 5:40 AM, Abdul wrote:

>> Hello Trend,
>>
>> Thanks so much for your help.
>> I just did a few tests, it is working now!!
>> I wonder what the meaning of 'bind the port' or 'echo udp server' are.
>>
>> Again, thanks so much.
>>
>> Peter
>
>

> peter u said that we need to blind the local port how can i do this ...i
>cannt understand this .... can u explain me this .....

it is BIND not BLIND.

http://linux.die.net/man/2/bind

"bind() assigns the address specified to by
addr to the socket referred to by the file descriptor sockfd."

--Nasser

Abdul

unread,
Jun 10, 2012, 8:49:07 AM6/10/12
to
"Nasser M. Abbasi" <n...@12000.org> wrote in message <jr1u6t$uq1$1...@speranza.aioe.org>...
> On 6/10/2012 5:40 AM, Abdul wrote:
>
> >> Hello Trend,
> >>
> >> Thanks so much for your help.
> >> I just did a few tests, it is working now!!
> >> I wonder what the meaning of 'bind the port' or 'echo udp server' are.
> >>
> >> Again, thanks so much.
> >>
> >> Peter
> >
> >
>
> > peter u said that we need to blind the local port how can i do this ...i
> >cannt understand this .... can u explain me this .....
>
> it is BIND not BLIND.
>

ya sorry its bind ... thanks for your help ... itried some other things and now its working .....

Abdul

unread,
Jun 10, 2012, 4:56:07 PM6/10/12
to
> Hello Trend,
>
> Thanks so much for your help.
> I just did a few tests, it is working now!!
> I wonder what the meaning of 'bind the port' or 'echo udp server' are.
>
> Again, thanks so much.
>
> Peter


i want to do udp communication using simulink model... can u tell me how to do this ... i tried but it does not work .. i have to create a udp object and open it in matlab interface first then it works otherwise it doesnot work it gives error that time out occur.. kindly help me ... thanks in advance .....

leo

unread,
Apr 11, 2013, 6:48:07 AM4/11/13
to
I'm in progress the projet for graduating about ANPR relating to transferring data between 2 computer, I tried to use UDP in Command prompt, it's OK. However, When I write in .m flie or in GUI, it always shows error timeout:
Warning: A timeout occurred before the Terminator was reached.

ans =
''

How do I fix this error?

Thank you very much.

My file:

In first computer:

%these values to be those of your first computer:
ipA = '192.168.1.7'; portA = 9090;
%these values to be those of your second computer:
ipB = '192.168.1.4'; portB = 9091;
%% Create UDP Object
udpB = udp(ipA,portA,'LocalPort',portB);
%% Connect to UDP Object
fopen(udpB)
fscanf(udpB)

In second computer:

%% Define computer-specific variables
ipA = '192.168.1.7'; portA = 9090 % Modify these values to be those of your first computer.
ipB = '192.168.1.4'; portB = 9091; % Modify these values to be those of your second computer.
%% Create UDP Object
udpA = udp(ipB,portB,'LocalPort',portA);
%% Connect to UDP Object
fopen(udpA)
fprintf(udpA,'number two.')

Umair

unread,
Apr 9, 2014, 11:19:10 AM4/9/14
to
"Trent Jarvi" wrote in message <frma2s$kjk$1...@fred.mathworks.com>...
>
> "pckong" <peter_k...@hotmail.com> wrote in message
> news:30237278.1205643583...@nitrogen.mathforum.org...
> > Hi all,
> >
> > I am doing school project and am getting desperate at this moment. I hope
> > in somewhere you will be able to give me some hints, as soon as possible.
> >
> > Here is what I got. I need to send data from a PC to the other, they are
> > both running matlab. The data transmission will be done with two sets of
> > wireless network card.
> >
> > I intended to set the data transmission done in a UDP object. Before I
> > made the attempt, an ad-hoc network has been set up, and it is tested
> > working. Here is some useful network information,
> > For PC1 (host) the IP address is 192.168.0.100 (not static IP)
> > For PC2 (client) the IP address is 192.168.0.223 (not static IP)
> >
> > I made a simple test to try sending data with matlab via port 9090, here
> > is what I did,
> > In PC1, I try to write an integer array to the client port
> > u=udp('192.168.0.223', 9090);
> > fopen(u)
> > fwrite(u, 1:10);
> > fclose(u)
> >
> > In PC2, I try to read the integer array from its port
> > u=udp('192.168.0.223', 9090);
> > fopen(u)
> > A=fread(u, 10);
> > fclose(u)
> >
> > But no matter how I try, I cannot retrieve the data. I cannot switch to do
> > the whole network programming in Linux as it is too late for me, and I
> > cannot do it in winsock either as I have written a whole bunch of other
> > programs in matlab already.
> >
> Hi Peter
>
> You need to bind the local port.
>
> % on 192.168.0.100
> u=udp('192.168.0.223', 9090,'LocalPort', 9091);
> fopen(u)
> fwrite(u, 1:10);
> fclose(u)
>
> % on 192.168.0.223
> u=udp('192.168.0.100', 9091, 'LocalPort' 9090 );
> fopen(u)
> fwrite(u, 1:10);
> fclose(u)
>
>
>

I am a telecom eng student and working on video streaming project over matlab. I have a few hundred frames extracted from video. Now i have to send those frames from pc A and receive them at pc B. But the process should include encoding it to binary at sender and then at receiver, decoding it to graphical format. The pictures should be transmitted, received and displayed in real time. My questions are

1) how to encode frames to binary at pc A and write it to port of pc B?
2) how to decode it at pc B and display picture then receive next frame?

siddarth...@gmail.com

unread,
Feb 11, 2020, 7:00:57 AM2/11/20
to
Hello Guys, I want to send data from one PC to other and I'm facing a lot issues regarding the address and port. Always it is throwing an error as address already in use and cannot bind. Please provide me the instructions. Thanks in advance.
my udp object code at sender
u=udp('0.0.0.0',136,'LocalPort',2000)
my udp object code at receiver
u=udp('127.0.0.1',2000,'LocalPort',136)


0 new messages