NoMethodError: undefined method 'bytesize'
Java を介して Ruby Sinatra サーバーに接続しようとすると、エラーが発生します。
これは私のルビーコードです。クライアントが接続したときに実行される何らかのメソッドが必要だと思いますが、よくわかりません:
require 'sinatra'
get '/hello' do
'this page displays hello'
end
get '/' do
'this page is the main page'
end
そして、これが私のJavaアプリケーションのコードです:
private static Socket connect;
private static OutputStream output;
private static InputStream input;
public static void main(String[] args) throws IOException {
System.out.println("Connecting...");
connect = new Socket(InetAddress.getByName("localhost"), 4567);
System.out.println("Connected to: " + connect.getInetAddress().getHostName());
output = new ObjectOutputStream(connect.getOutputStream());
output.flush();
//input = new ObjectInputStream(connect.getInputStream());
System.out.println("Streams ready");
}