Cần trợ giúp việc chuyển file không chờ upload xong qua Internet

Đây là một topic dông dài, nói dài nói dở và sờ-tíu-pịt, khẳng định ngay luôn là như vậy.

Như các bạn biết, ai đã dùng máy tính giai đoạn trước 2012 thì gần như đã từng dùng đến các phần mềm như Skype, Yahoo! Messenger hoặc một công cụ chat nào đó có chức năng gửi file. Phải nói rằng ngày đó Internet chậm hơn bây giờ nhiều nhưng gửi file là cái gì đó… huy hoàng.

Tại vì sao ngày đó gửi file là… huy hoàng? Tại vì ngày nay những công cụ đó chết ráo trọi, muốn xài cho việc gửi file cũng không thể được.

Huy hoàng bởi vì khi bạn gửi file một phát là bên kia thấy thanh trạng thái được bao nhiêu phần trăm. Khi thấy đầy thanh ttrạng thái là click mở file. Bạn không phải download gì về nữa, phần mềm đã lưu tạm đâu đó trên máy. Như vậy, khá giống với việc “copy trực tiếp qua mạng” :smiley:

Sau này, khi Internet đã nhanh hơn, và có cả cloud các kiểu con đà điểu nhưng mấy tháng gần đây Thin lại khóc thét với việc gửi file vì phải upload lên để bên kia tải về, chưa upload xong thì bên kia tải bằng… chờ đợi.

Lý do: tui phải upload lên cloud hoặc server, và nó hoàn tất thì bạn tui mới có thể bắt đầu tải file về sử dụng => mất gấp đôi thời gian so với kiểu gửi file huy hoàng trước đây.

Trong khi đó, hàng ngày số lượng file cần chuyển qua lại giữa tui và bạn khá lớn, số file lượng lớn, và có khi kích thước file cũng huge (từ 4GB đến 80GB đi - về 3-4 lượt/ ngày). Vì nằm trong tỉnh nên có lúc tui đành gỡ ổ cứng trong máy ra, chạy 23km mang ổ cứng và mang ổ cứng nó về còn nhanh hơn gửi qua Internet.

Hai thằng cảm thấy buồn bực quá, tìm mãi cũng không ra phần mềm nào có thể gửi trực tiếp file qua cho thằng bạn như kiểu ngày xưa mà hỗ trợ file khủng, nhất là nó xài macOS, tui lại xài Linux thì càng hiếm phần mềm.

Tui và nó cũng đã nghĩ đến giải pháp là dùng giao thức BitTorrent và dùng trình tải Torrent nào đó để gửi file cho nhau. Nhưng thế quái nào đó việc seed và tải cọc cạch mãi mà vẫn chưa được, rồi còn phải port forwarding các kiểu trong khi 2 thằng đầu có “cục router” xài IPv6, máy tính mặc định địa chỉ IPv6, kiến thức mạng mẽo mở port và mật khẩu router quên hết ráo nên cũng hoay hoay cả tuần mà không ăn thua.

Nói chung, tthử các phương án thì đều thấy quá lằng nhằng, cài cắm phức tạp nhưng đều không đạt được điều mong muốn dù mạng 2 bên gói cước tốc độ không thật cao nhưng ổn định, không bị rớt mạng.

Giờ đây, nhờ anh em cao thủ võ lâm cùng ra tay trợ giúp các cách nếu có phần mềm dạng miễn phí/ nguồn mở càng tốt để gửi file qua mạng giữa 2 máy tính macOS và LinuxMint (có thể có qua trung gian để không phải mở port, né được tường lửa bởi phần mềm dùng port mặc định mở, nhưng không đợi upload hoàn thành), nếu phần mềm này chạy được trên 2 máy Windows cũng OK vì có thể chạy máy ảo để dùng tạm.

Chân thành cám ơn mọi người!

P/S: đến giờ phút này tui hiều vì sao ông Linus Torvalds nói rằng ổng không dùng Debian vì cà đặt khó không hẳn là câu nói đùa mà một người có thể siêu sao về cái này, nhưng cái khác (khá tương tự) họ cũng chưa chắc trừ khi mất nhiều nỗ lực một cách vô lý.

First, Linux is like Windows, evolving from version to version, becoming more complicated and larger than the old ones with each new version. Linus Torvalds wrote Linux based on his AT&T UNIX knowledge. He did this because he didn’t have the money for a UNIX license. I think it’s a coincidence that Linus said he wouldn’t use Debian, because Debian, or whatever Linux kernel, is definitely different from his original Linux—for example, with new features like image processing, sound, etc.

And yes, I understand your problems with transferring large files. In the past we used to only have small data files. Now we have big image or audio files alongside them, which are usually huge. Google recognized the problem and invented WEBP/WEBM, which is even more compressed than JPEG/MP4, but the files are still large.

I’m not familiar with BitTorrent and its functionality (or implementation). However, the internet is based on TCP or UDP, and the maximum data packet size is about 64 kBytes or 512 kBit, no more. Even the internet has fiber optic cables capable of 100 Gbps. To solve your problem, you’ll need to create a C/S app yourself. A JAVA example using SocketChannel might give you an idea. However, you and your friends will need to set up “port forwarding” to perform the transfer over the internet. How? Click HERE or HERE.

Receiver (IP and port from Port Forwarding):

      SocketChannel soc = null;
      try {
        soc = SocketChannel.open(new InetSocketAddress(host, port));
        soc.socket().setReceiveBufferSize(65536); // 64KB
        soc.socket().setTcpNoDelay(true);
        ByteArrayOutputStream bao = new ByteArrayOutputStream(65536);
        ByteBuffer bbuf = ByteBuffer.allocateDirect(65536);
        // read filename
        int p = soc.read(bbuf);
        while (p <= 0) imeUnit.MICROSECONDS.sleep(100);
        byte[] buf = new byte[p];
        ((ByteBuffer)bbuf.flip()).get(buf, 0, p);
        //
        String fName = new String(buf);
        System.out.println("Save as "+fName);
        System.out.println("Reading "+fileName+" from Server");
         while ((p = soc.read(bbuf)) > 0) {
          buf = new byte[p];
          ((ByteBuffer)bbuf.flip()).get(buf, 0, p);
          bao.write(buf, 0, p);
          bbuf.clear();      
        }
        bao.flush();
        fout = new FileOutputStream(fName, false);
        fout.write(bao.toByteArray());
        fout.flush();
        fout.close();
        bao.close();
        //
      } catch (Exception ex) {
        System.out.println("Error:\n"+ex.toString());        
      }
      if (soc != null) try {
        soc.close();
      } catch (Exception ex) { }

Sender (IP and port from Port Forwarding)::

      SocketChannel soc = null;
      try {
        soc = SocketChannel.open(new InetSocketAddress(host, port));
        soc.socket().setSendBufferSize(65536);
        soc.socket().setTcpNoDelay(true);
        //
        ByteArrayOutputStream bao = new ByteArrayOutputStream(65536);
        ByteBuffer bbuf = ByteBuffer.allocateDirect(65536);
        // tell receiver the filenam
        byte[] buf = fileName.getBytes();
        socket.write(ByteBuffer.wrap(buf, 0, buf.length));
        //
        System.out.println("send file: "+fileName);
        File file = new File(fileName);
        if (!file.exists()) {
          System.out.println(fileName+" does not exist.");
          System.exit(0);
        }
        bao.write(Files.readAllBytes(file.toPath()));
        buf = bao.toByteArray();
        int n = 0, l = 65536, max = buf.length;
        while (n < max) { // Streaming         
          if ((n+65536) > max) l = max - n;
          socket.write(ByteBuffer.wrap(buf, n, l));
          TimeUnit.MILLISECONDS.sleep(10);
          if (l < 65536) break;
          n += l;
        }
      } catch (Exception ex) {
        System.out.println("Error:\n"+ex.toString());        
      }
      if (soc != null) try {
        soc.close();
      } catch (Exception ex) { }
1 Like

Thử xem perplexity trả lời câu hỏi lôi thôi của superthin ra sao. Đây là kết quả:

Dưới đây là tóm tắt các giải pháp gửi file trực tiếp giữa Linux và macOS cho file lớn (4GB đến 80GB) mà không cần cloud, open port phức tạp, ưu tiên miễn phí, mã nguồn mở và P2P:

1. LocalSend

  • Gửi file trực tiếp qua LAN hoặc relay công khai, mã hóa end-to-end.
  • Native trên Linux (AppImage/Flatpak), macOS, Windows, Android, iOS.
  • Tốc độ cao, lên đến 100MB/s trên LAN.
  • Dùng GUI thân thiện, dễ cài đặt, không cần cấu hình mạng phức tạp.
  • Hạn chế: tốt nhất khi cùng mạng, không hỗ trợ resume nếu gián đoạn.

2. Croc

  • Công cụ dòng lệnh, mã nguồn mở, an toàn với mã hóa PAKE.
  • Chạy trên Linux, macOS, Windows, không cần open port.
  • Hỗ trợ file lên trăm GB, tự động nén tăng tốc.
  • Giao diện CLI, tạo mã chia sẻ để nhận file.
  • Hạn chế: không có GUI sẵn, phụ thuộc relay có thể chậm.

3. Transmitic

  • Phần mềm GUI P2P, mã nguồn mở, hỗ trợ NAT traversal.
  • Hỗ trợ gửi file lớn, mã hóa end-to-end, resume tự động.
  • Tương thích Linux (AppImage), macOS, Windows.
  • Dùng quét mã QR hoặc ID kết nối trực tiếp.
  • Hạn chế: vẫn đang phát triển, không hỗ trợ gửi folder trực tiếp (cần zip).

So Sánh Nhanh

Công Cụ Giao Diện File Lớn 80GB+ Không Open Port Mã Nguồn Mở Tốc Độ Ước Tính Ưu Tiên Sử Dụng
LocalSend GUI Có (NAT traversal) Cao trên LAN Gửi nhanh trong cùng mạng
Croc CLI Có (relay tự động) Nhanh, nén tự động Gửi file qua mạng xa, script
Transmitic GUI Có (P2P trực tiếp) Cao, resume tự động Gửi file dễ dùng, mã hóa mạnh

Lời Khuyên

  • Test trước trên LAN hoặc qua VPN (như WireGuard) để tối ưu tốc độ.
  • Nén file trước để giảm băng thông, tăng tốc chuyển.
  • Nếu cần giao diện dễ dùng, LocalSend là lựa chọn tốt nhất để bắt đầu.
  • Croc phù hợp người quen CLI và cần truyền file qua mạng khác vùng.
  • Transmitic phù hợp khi cần GUI và khả năng phục hồi transfers.
1 Like

@superthin said:

Vì nằm trong tỉnh nên có lúc tui đành gỡ ổ cứng trong máy ra, chạy 23km mang ổ cứng và mang ổ cứng nó về còn nhanh hơn gửi qua Internet.

23 km is quite a long distance, and I doubt there’s a LAN that large except through a private WAN (Wide Area Network). If I understand @superthin correctly, he took his hard drive to his friends’ house and created a local copy. So he doesn’t have a WAN other than the public WAN, which is called the internet.

I’m not familiar with the tools you mentioned, but as you suggested,

Test the LAN router with a VPN (e.g., WireGuard) and perform the file transfer.

So these tools only work with the local network. That means you connect your computer to your friend’s router, then you can transfer the files. It’s the same as taking your computer to his friend’s house, connecting it, and performing the copy using the available operating system command (e.g., the SCP command). MacOS is based on BSD UNIX and also has the same SCP command. So why so much effort with third-party tools?

1 Like

We have no leased-line cable Internet, no LAN network from my house to my friend’s house. We use Internet for family package from ISP in Vietnam: VNPT, Viettel, FPT. I can use nc (Netcat) to transfer files but my friend cannot because he is a graphic designer, video editor not a… nerd/ hacker :smiley: so it’s a clumsy situation. Maximum upload speed 220Mbps.

1 Like

Hi @superthin

As mentioned above, the Internet or LAN operates using TCP/IP, and the maximum data packet size is 64 K bytes or 512 K bits. Assuming you have a 1 Gbps Internet connection, the maximum download or upload speed is 1.9 Mbps or 0.244 MB/s. Therefore, a huge file of several GB can take quite a while to download. The latency and the server load eat up time so that you never get the theoretical speed promised by your Internet provider. The more load (traffic) the longer the delay. For individuals or small businesses, a private WAN is too expensive. Therefore, the only alternative is the internet. However, the speed is like rubber—sometimes fast, sometimes slow. Nevertheless, you can use the internet as a private WAN if you know how to bypass the proxy host (other than your own provider’s) with your local IP address and a forwarding port, as well as your own download/upload tool.
b1
Port forwarding: This allows you to access your computer over the internet. To do this, make sure your router’s IP address is static or never turn it off so the dynamic IP address remains unchanged. Then configure any port number for your router. The procedure depends on your router manufacturer, so consult your internet provider and/or router manufacturer.

Once you’ve successfully configured port forwarding, you can create your own file transfer app. I’ve created a simple JAVA app called “FileTransfer” for you (it took me two days to design and test). Why JAVA? Because of WORA (Write Once Run Anywhere). This means it works on Windows, Linux, Android, and macOS.

The GUI is Java SWING and works file-to-file. It can be easily adapted for directory-to-directory operations.

import java.io.*;
import java.net.*;
import java.nio.*;
import java.util.*;
import java.nio.file.*;
import java.nio.channels.*;
import java.util.concurrent.*;
//
import javax.swing.*;
// Joe Schwarz (C)
public class FileTransfer extends JFrame {
  //
  private ExecutorService pool = Executors.newFixedThreadPool(20);
  private JTextField tFile, tIP, tPort, tSave, tHome;
  private boolean end = false, local = false;
  private String fileName, utf8 = "UTF-8";
  private JButton SEND, RECEIVE, QUIT;
  //private ServerSocketChannel server;
  private char x00 = (char)0x00;
  private JLabel msg;
  //
  public static void main(String... argv) throws Exception {
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
    new FileTransfer(argv);
  }
  // Constructor
  public FileTransfer(String... argv) throws Exception {
    int port = 12345;
    int hPort = 23456;
    if (argv.length == 1) {
      port = Integer.parseInt(argv[0]);
    } else if (argv.length > 1) {
      port = Integer.parseInt(argv[0]);
      hPort = Integer.parseInt(argv[1]);
    }
    setTitle("FileTransfer (JS - Oct. 7th 2025)");
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    //
    String uHome = System.getProperty("user.home");
    fileName = uHome+File.separator+"AnyName";
    //
    msg = new JLabel("FileTransfer");
    JLabel lHome = new JLabel("HomePort:");
    JLabel lSave = new JLabel("Save Dir:");
    JLabel lFile = new JLabel("FileName");
    JLabel lIP = new JLabel("remoteIP");
    JLabel lPort = new JLabel("Port");
    //
    tSave = new JTextField(uHome+File.separator+"Downloads"+File.separator);
    tFile = new JTextField(fileName);
    tIP = new JTextField("localhost");
    tPort = new JTextField(port+"");
    tHome = new JTextField(hPort+"");
    //
    SEND = new JButton("SEND");
    SEND.addActionListener(e -> {
      disabled();
      sendFile(null);
      enabled();
    });
    RECEIVE = new JButton("RETRIEVE");
    RECEIVE.addActionListener(e -> {
      disabled();
      retrieveFile(null);
      enabled();
    });
    QUIT = new JButton("QUIT");
    QUIT.addActionListener(e -> {
      try {
        end = true;
        pool.shutdownNow();
        TimeUnit.MICROSECONDS.sleep(200);
      } catch (Exception ex) { }
      System.exit(0);
    });
    JPanel cm = new JPanel(); cm.add(msg);
    JPanel ch = new JPanel(); ch.add(lHome); ch.add(tHome);
    JPanel cs = new JPanel(); cs.add(lSave); cs.add(tSave); 
    JPanel c0 = new JPanel(); c0.add(lFile); c0.add(tFile);
    JPanel c1 = new JPanel(); c1.add(lIP); c1.add(tIP); c1.add(lPort); c1.add(tPort);
    JPanel c2 = new JPanel(); c2.add(SEND); c2.add(RECEIVE); c2.add(QUIT);
    //
    JPanel center = new JPanel(new java.awt.GridLayout(6, 0));
    center.add(cm); center.add(ch); center.add(cs); center.add(c0); center.add(c1); center.add(c2);
    add(center);
    //
    setSize(400,240);
    setVisible(true);
    pool.execute(() -> {
      ServerSocketChannel server = null;
      try { // FileServer
        String hp = tHome.getText();
        msg.setText("FileServer @"+hp+" is running");
        server = ServerSocketChannel.open();
        server.socket().bind(new InetSocketAddress(Integer.parseInt(hp)));
        server.setOption(StandardSocketOptions.SO_RCVBUF, 65536);
        while (!end) pool.execute(new Xfer(server.accept()));
      } catch (Exception ex) {
        if (!end) {
          ex.printStackTrace();
          System.exit(0);
        }
      }
      if (server != null) try {
        server.close();
      } catch (Exception ex) { }
    });
    
  }
  //
  private void retrieveFile(SocketChannel soc) {
      local = soc == null;
      long t0 = System.nanoTime();
      try {
        int p;
        byte[] buf = null;
        if (local) {
          fileName = tFile.getText();
          String host = tIP.getText();
          p = Integer.parseInt(tPort.getText());
          soc = SocketChannel.open(new InetSocketAddress(host, p));
          soc.socket().setReceiveBufferSize(65536); // 64KB
          soc.socket().setTcpNoDelay(true);
          buf = fileName.getBytes();
          soc.write(ByteBuffer.wrap(buf, 0, buf.length));
          TimeUnit.MICROSECONDS.sleep(100);
          msg.setText("Retrieve "+fileName+" from Server:"+p);
        }
        p = fileName.lastIndexOf(File.separator)+1;
        fileName = tSave.getText()+fileName.substring(p);
        ByteArrayOutputStream bao = new ByteArrayOutputStream(65400);
        ByteBuffer bbuf = ByteBuffer.allocate(65400);
        while ((p = soc.read(bbuf)) > 0) {
          buf = new byte[p];
          ((ByteBuffer)bbuf.flip()).get(buf, 0, p);
          bao.write(buf, 0, p);
          bbuf.clear();      
        }
        bao.flush();
        FileOutputStream fout = new FileOutputStream(fileName, false);
        fout.write(bao.toByteArray());
        fout.flush();
        fout.close();
        bao.close();
        //
      } catch (Exception ex) {
        if (local) msg.setText("Error:\n"+ex.toString());               
      }
      if (soc != null) {
        try {
          soc.close();
        } catch (Exception ex) { }
        if (local) {
          msg.setText(String.format("Saved %s - Total(milliSec.): %.2f",
                                    fileName, ((float)(System.nanoTime()-t0)/1000000))
                                   );
        }
      }
  }
  //
  private void sendFile(SocketChannel soc) {
      local = soc == null;
      try {
        File file = null;
        byte[] buf = null;
        if (local) { // local send
          fileName = tFile.getText();
          file = new File(fileName);
          if (!isExisted()) {
            msg.setText(fileName+" is unknown.");
            return;
          }
          String host = tIP.getText();
          int port = Integer.parseInt(tPort.getText());
          soc = SocketChannel.open(new InetSocketAddress(host, port));
          soc.socket().setSendBufferSize(65536);
          soc.socket().setTcpNoDelay(true);
          // send the filename with the prefix X00
          buf = (x00+fileName.substring(fileName.lastIndexOf(File.separator)+1)).getBytes(utf8);
          soc.write(ByteBuffer.wrap(buf, 0, buf.length));
          TimeUnit.MICROSECONDS.sleep(10);
          msg.setText("send file: "+fileName);
        } else { // retrieve
          file = new File(fileName);
          if (!file.exists()) {
            buf = (fileName+" is unknown!").getBytes();
            soc.write(ByteBuffer.wrap(buf, 0, buf.length));
            soc.close();
            return;
          }
        }
        buf = Files.readAllBytes(file.toPath());
        // send the entire content to Requester
        soc.write(ByteBuffer.wrap(buf));
      } catch (Exception ex) {
        if (local) msg.setText("Error:\n"+ex.toString());        
      }
      if (soc != null) try {
        soc.close();
      } catch (Exception ex) { }
  }
  // Service for FileTransfer
  private class Xfer implements Runnable {
    public Xfer(SocketChannel soc) {
      this.soc = soc;
    }
    private SocketChannel soc;
    public void run() {
      try {
        soc.socket().setSendBufferSize(65536);
        soc.socket().setTcpNoDelay(true);
        ByteBuffer bbuf = ByteBuffer.allocate(1024);
        int p = soc.read(bbuf);
        byte[] buf = new byte[p];
        ((ByteBuffer)bbuf.flip()).get(buf, 0, p);
        if (buf[0] == (byte)x00) { // send from remote
          fileName = new String(buf, 1, p-1, utf8);
          retrieveFile(soc);
        } else { // retrieve from remote
          fileName = new String(buf, utf8);
          sendFile(soc);
        }
      } catch (Exception ex) { ex.printStackTrace();}
    }
  }
  private boolean isExisted() {
    return (new File(fileName)).exists();
  }
  private void disabled() {
    RECEIVE.setEnabled(false);
    QUIT.setEnabled(false);
    SEND.setEnabled(false);
  }
  private void enabled() {
    RECEIVE.setEnabled(true);
    QUIT.setEnabled(true);
    SEND.setEnabled(true);
    local = false;
  }
}

How to run:

java FileTransfer remoteServerPort localServerPort
// example
java FileTransfer 1234 5678

Xfer.
The SEND and RETRIEVE precondition that this app run on both sites: remote and local (it’s a P2P communication). The transfer time 26.64 milli second for a file Alpine.png with the size of 2 MB

-rw-rw-r-- 1 erika erika 2112560 Feb 27  2025 Alpine.png
1 Like

Many ways are very good. But “port forwarding” is the cornerstone we cannot move away, and sometimes ISP implements NAT (they are still prefer IPv4) to save their IPs. That hurts us painfully. We are thinking of WebRTC to send file from web browser to web browser but this feature is not a button or easy thing to use.

I have searched for WebRTC-related things on GitHub to see if there are any usable tools, but the JavaScript and TypeScript code snippets seem overwhelming to me.

Có 2 cách nhanh gọn:

  • Cách 1: Dùng app chuyên dùng cho vấn đề của bạn: https://docs.syncthing.net/intro/getting-started.html . Đây là open source, bạn có thể tự thiết lập và nghiên cứu nhé. Nó giải quyết chính xác bài toán peer-to-peer sync files.
  • Cách 2: Dùng VPN để thiết lập LAN ảo rồi rsync mà phang thôi.
1 Like

@nitro2
@superthin
@just1minute
Let’s move on to the bit-byte level.
All apps running over LAN or the Internet must adhere to TCP/IP rules. This means that the data packet cannot exceed 64 KB. This physical law was established by TCP/IP. Large amounts of data are “chopped” into chunks (up to 64 KB) when sent and “reassembled” when received.
Depending on the implementation, the data packet size can be less than (64 KBytes - the TCP/IP header bytes), and data is read and sent depending on the loop.
I don’t know of any apps that @nitro2 or @just1minute mentioned, but all apps must support TCP/IP.

Syncthing works by creating a secure, decentralized peer-to-peer network where files are synchronized directly between your devices without a central server. It segments files into blocks for efficient transfer, synchronizes them over a local network or the internet, and uses a discovery server to find and connect devices. Each device is identified by a unique ID, and all data is encrypted end-to-end to ensure privacy and security, with users controlling which folders are shared between authorized devices.
(see: https://www.youtube.com/watch?v=XOYwSCtJH5U)

Latency and the time required for identification and encryption/decryption are significant. I found the following comment on the Syncthing forum:

Syncthing is designed to be capable of synchronizing two computers over the internet without needing to create custom configurations on your routers. The software will try and use universal plug-and-play.
It also uses a feature referred to as global Discovery.
However, being an IT guy, I choose to use port forwarding to make things a little bit faster and more reliable than they can be depending upon where you are in the world and how far apart they are etc.

That’s why I suggest port forwarding.
@superthin: Port forwarding is used for IPv4. This allows you to tell your ISP’s computer (Viettel?) that this assigned IP has this port for public “tunneling.” IPv6 does NOT require port forwarding. This means you can work directly with IPv6 and a port—without messing around with Port Forwarding.

I didn’t say any that “port forwarding” not working. But it has security risk.
If you try opening a port in your router and “observe” it for 1 day. You will see a few hundred connections from remote strange IPs trying to sneak into that port.
Many hackers love to explore your open port by their ultimate tools and I also did some.
Few years ago, I opened my mongo database port for my friend to inject data to it daily. You know what? It was hacked after few weeks and they requested me some bitcoins to unlock the database.
Believe me, sending unencrypted data to port forwarding is your last choice.

2 Likes

Dear @nitro2
I didn’t say anything about port forwarding in your comment, just the name Syncthing and its functionality. You misunderstood me. Thanks for the tip about hacking, but that seems to be rare, because who else but YOU and YOUR FRIEND knows which port you’ve forwarded? :disappointed_relieved: :cold_sweat:

@superthin
You can “see” what IPv6 you have by using this site, for example, whatismyipaddress.com
whatismyipaddress.
And my little app “FileTransfer” will look like this
IPv6.

1 Like

No no, don’t underestimate hackers. They run scanning tools every day. There are tons of servers that scan IPs and Ports every minute. They are doing this on purpose.
Just a simple nmap -sS -Pn -T5 -p- [target-ip] command can scan all open ports from a IP.

I just leave a warning here. You can also post your code to a ChatGPT to see your program security weakness.

2 Likes

Really? It seems like today’s world is even shittier than the world I worked in between 1980 and 2010. :cold_sweat:

2 Likes

This is just a simple example to demonstrate how you can conduct P2P, or peer-to-peer, communication over the internet without relying on others. Incidentally, with IPv6, it could be secure, since the port is invisible outside your computer (see image)

1 Like

Bạn dùng thử cái này chưa (P2P): https://www.iroh.computer/sendme

1 Like

Haha, trong quá trình TeamViewer qua máy thằng bạn để cài căm thử phần mềm mà các bạn gọi ý thì thấy TeamViewer có chức năng gửi file, quá mừng vui… tuyệt thật.

Nhưng rồi sau đó thì thấy chỉ được file 4GB mà thôi :frowning:

Vẫn đang tiếp tục tìm kiếm, thử nghiệm theo sự trợ giúp của các bạn và tìm ra cái ổn định, dễ dùng.

If you’re thinking BIG, you’ll have to pay or develop your own app that does the job. For example:

Or create an app with Loop, for example:

  private void retrieveFile(SocketChannel soc, String fileName) throws Exception {
      int p;
      byte[] buf = new byte[65400];
      FileOutputStream fout = new FileOutputStream(fileName, false);	
      ByteBuffer bbuf = ByteBuffer.allocate(65400);
      while ((p = soc.read(bbuf)) > 0) {
        ((ByteBuffer)bbuf.flip()).get(buf, 0, p);
        fout.write(buf, 0, p);
        bbuf.clear();      
      }
      fout.close();
  }
  private void sendFile(SocketChannel soc, String filenName) {
    try {
      int n;
      byte[] buf = new byte[65400];
      FileInputStream fin = new FileInputStream(fileName);
      while ((n = fin.read(buf)) > 0) soc.write(ByteBuffer.wrap(buf, 0, n));
      fin.close();
    } catch (Exception ex) {
      try { 
        soc.write(ByteBuffer.wrap((fileName+" is unknown!").getBytes()));
      } catch (Exception e) { }
    }
  }

You can use these two methods to retrieve or send files larger than 4 GB.
Note: JAVA doesn’t consider the size of a file, only the number of bytes to be read or written. This number is a maximum of 2 GB, or 2147483648 bytes, that JAVA can read and write as a byte array.

1 Like
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?