import java.net.*;
import java.util.*;
import java.io.*;
import static  BH.Bytes_Hex.*;

public class byteClient {
    public static void main(String args[]) {
        try {
            String the_message="hello Server";
            Socket c_sock;
            byte[] the_bytes=the_message.getBytes("UTF8");
            System.out.println(ByteArray2HexString(the_bytes));
            InetAddress ip = InetAddress.getByName("localhost");
            try {
                c_sock = new Socket(ip, 5000);
            } catch (Exception e1) {
                System.out.println("Port  not Available");
                return;
            }
            DataOutputStream dataOut = new DataOutputStream(c_sock.getOutputStream());
            dataOut.writeInt(the_bytes.length); // write length of the message
            dataOut.write(the_bytes);           // write the message
            System.out.println("the_bytes length Written= "+the_bytes.length);                      //
        } catch (Exception e) {
        }
    }
}