NoMethodError: undefined method 'bytesize'
当我尝试通过 java 连接到我的 ruby sinatra 服务器时出现错误。
这是我的 ruby 代码,我怀疑我需要某种方法,它在客户端连接时运行,但我不确定:
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");
}