Skip to content

Instantly share code, notes, and snippets.

@mizofumi
Last active August 29, 2015 14:18
Show Gist options
  • Select an option

  • Save mizofumi/e17829522aeb38a1fd7f to your computer and use it in GitHub Desktop.

Select an option

Save mizofumi/e17829522aeb38a1fd7f to your computer and use it in GitHub Desktop.
TvTestRemoteClientExample
import java.io.*;
import java.net.*;
public class TvTestRemoteClientExample {
public static void main(String[] args) {
Socket socket = null;
DataOutputStream os = null;
BufferedReader is = null;
// サーバを開く
try {
socket = new Socket("192.168.11.1", 17000); //サーバのIPとポート
os = new DataOutputStream(socket.getOutputStream());
is = new BufferedReader(new InputStreamReader(socket.getInputStream()));
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
if (socket != null && os != null && is != null) {
try {
//データ送信(コメントを解除している部分が実行されます)
os.writeBytes("VolUp"); //ボリューム上げ (カーソルキーの上)
//os.writeBytes("VolDown"); //ボリューム下げ (カーソルキーの下)
//os.writeBytes("ChPrev"); //前のチャンネル (カーソルキーの左)
//os.writeBytes("ChNext"); //次のチャンネル (カーソルキーの右)
//os.writeBytes("Ch1"); //チャンネル1 (ファンクションキーの1)
//os.writeBytes("Fullscreen");//全画面 (Alt+Enter)
//os.writeBytes("Mute"); //ミュート (M)
//os.writeBytes("Rec"); //録画 (R)
//os.writeBytes("Cap"); //画像保存 (V)
//os.writeBytes("Tvprogram"); //番組表 (E)
//os.writeBytes("Front"); //常に前面に表示 (T)
//os.writeBytes("Sound"); //音声切替 (S)
//os.writeBytes("Startup"); // 起動
//os.writeBytes("Shutdown"); // 終了
//ソケットクローズ
os.close();
is.close();
socket.close();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment