How do I send a file .txt or .evt between two computers using TCP/IP
이전 댓글 표시
I need send files but just found how tranfer cha.
답변 (4개)
Walter Roberson
2015년 8월 1일
file_as_char = fileread('YourFile.evt');
Now file_as_char is char that can be sent.
I'd say "by email". More seriously, if you need to build a client-server system, look at the following:
The example is easy to run on two distinct machines, and you can send a file content this way.
Vanessa ricardo
2015년 8월 1일
댓글 수: 3
Walter Roberson
2015년 8월 1일
t = tcpip('192.168.7.195', 50000, 'NetworkRole', 'client');
fopen(t)
pause(2);
file_as_char = fileread('YourFile.evt');
fwrite(t, file_as_char);
On the receiving side
data = fread(t);
Vanessa ricardo
2015년 8월 1일
But at this stage I have to ask you how serious your project is, how large are the files that you need to transfer, and why you need to manage file transfer from MATLAB. Because writing a solid/stable client-server system is complicated.
For a small project, I would play with TCPIP etc, because it is "fun" to learn a bit how to deal with these things. If I had to build a solid/stable solution though, I would install an FTP server or a Web server, or anything which supports protocols for transferring files, and I would use this from MATLAB. If one machine had an FTP server for example, I would use
Then I would just test the presence of new files, or use TCPIP for signaling/synchronizing transfers, and let the FTP client/server, WGET, etc, manage file transfers properly.
Vanessa ricardo
2015년 8월 1일
0 개 추천
댓글 수: 5
Walter Roberson
2015년 8월 1일
The techniques you would use for tcp are not the same as what you would use for a modem.
When you are using a modem, you should prefer to use a modem file transfer mechanism that has already well tested. For example use Kermit, or zmodem, both of which can deal with transferring multiple files. If you are using MS Windows, you could consider using hyperterminal
Vanessa ricardo
2015년 8월 1일
Cedric
2015년 8월 1일
But the first thing that you need to clarify is the context. Is this file transfer something that you need to do only once, how many files, how large they are roughly, why MATLAB, etc.
Vanessa ricardo
2015년 8월 1일
Walter Roberson
2015년 8월 2일
Is this to solve a practical problem, or is it a university assignment? If it is to solve a practical problem, then do not use MATLAB for this: use one of the existing tools such as kermit or hyperterm.
카테고리
도움말 센터 및 File Exchange에서 TCP/IP Communication에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!