Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.net.Socket;

import java.io.OutputStream;

public class Main {
    public static void writeNetSocket(Socket socket, String data, int timeoutMS) throws Exception {
        writeNetSocketBytes(socket, data.getBytes(), data.length());
    }

    public static void writeNetSocketBytes(Socket socket, byte[] buffer, int len) throws Exception {
        OutputStream os = socket.getOutputStream();
        os.write(buffer, 0, len);
        os.flush();
    }
}