Jose Cao

Greenhorn
+ Follow
since Nov 06, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jose Cao

Hi,
I have the following code:
//-----
1 public static String leer(BufferedReader sin) {
2 StringBuffer line = new StringBuffer();
3
4 try {
5
6 for (int ch; (ch = sin.read()) != 1; ){
7 line.append(ch);
8 }
9
10 } catch (IOException e) {
11 System.out.println("leer: " + e.toString());
12 }
13 if (linea != null)
14 System.out.println(line.substring(0));
15 return line.substring(0);
16 }
//-----
The problem is, at line 6, "sin.read()" returns a int (which is a unicode code) and I need the equivalent character to build a string. How can I obtain the character that corresponds to this unicode code?
Thanks in advance.
19 years ago
Hi,
I have the following code:
//-----
1 public static String leer(BufferedReader sin) {
2 StringBuffer line = new StringBuffer();
3
4 try {
5
6 for (int ch; (ch = sin.read()) != 1; ){
7 line.append(ch);
8 }
9
10 } catch (IOException e) {
11 System.out.println("leer: " + e.toString());
12 }
13 if (linea != null)
14 System.out.println(line.substring(0));
15 return line.substring(0);
16 }
//-----
The problem is, at line 6, "sin.read()" returns a int (which is a unicode code) and I need the equivalent character to build a string. How can I obtain the character that corresponds to this unicode code?
Sorry if this is a simple question.
Thanks in advance.
19 years ago
Hi,
I have the following code:
//-----
1 public static String leer(BufferedReader sin) {
2 StringBuffer line = new StringBuffer();
3
4 try {
5
6 for (int ch; (ch = sin.read()) != 1; ){
7 line.append(ch);
8 }
9
10 } catch (IOException e) {
11 System.out.println("leer: " + e.toString());
12 }
13 if (linea != null)
14 System.out.println(line.substring(0));
15 return line.substring(0);
16 }
//-----
The problem is, at line 6, "sin.read()" returns a int (which is a unicode code) and I need the equivalent character to build a string. How can I obtain the character that corresponds to this unicode code?
Thanks in advance.
19 years ago
Thanks a lot for your help !!!
It was very useful for me !!!
Bye.

Originally posted by Jose Cao:
Hi,
I have the folowing code:
1 Socket socket = new Socket(host, port);
2 PrintWriter sout =
new PrintWriter(socket.getOutputStream(),true);
3
4 BufferedReader sin = new BufferedReader(
5 new InputStreamReader(
6 socket.getInputStream()));
7
8
9 InputStreamReader sin =
new InputStreamReader(socket.getInputStream());
10 // I read the firts line produced by the
// remote machine
11 String line = sin.readLine();
12 line = sin.readLine();
13
14
15 // I put login and password to the remote machine
16 sout.println(login);
17 sout.println(passwd);
18
19 line = sin.readLine();
20
21 // I put the command to the remote machine
22 sout.println("hssdp:snb=158" + nro_telf + ",list;");
When I execute this code in Windows 2000 everything works fine.
When I excute this code in UNIX (Solaris) everything works fine
until line 19. When the program reach line 19, it stays hold and do
nothing else. What could be the problem ???
Please help !!!
Thanks in advance.
[ November 06, 2002: Message edited by: Jose Cao ]

19 years ago
Hi,
I have the folowing code:
1 Socket socket = new Socket(host, port);
2 PrintWriter sout =
new PrintWriter(socket.getOutputStream(),true);
3
4 BufferedReader sin = new BufferedReader(
5 new InputStreamReader(
6 socket.getInputStream()));
7
8
9 InputStreamReader sin =
new InputStreamReader(socket.getInputStream());
10 // I read the firts line produced by the
// remote machine
11 String line = sin.readLine();
12 line = sin.readLine();
13
14
15 // I put login and password to the remote machine
16 sout.println(login);
17 sout.println(passwd);
18
19 line = sin.readLine();
20
21 // I put the command to the remote machine
22 sout.println("hssdp:snb=158" + nro_telf + ",list;");
When I execute this code in Windows 2000 everything works fine.
When I excute this code in UNIX (Solaris) everything works fine
until line 19. When the program reach line 19, it stays hold and do
nothing else. What could be the problem ???
Please help !!!
Thanks in advance.
[ November 06, 2002: Message edited by: Jose Cao ]
19 years ago