Error reading a socket

Hello, please i need some help.

I have a method which is reading from Sockets inputStream

i need to read multi-line response

i have

String temp = "";

while( (temp = in.readLine()) != null)

{

//Process line

}

But is seems, that it didnt end when server responds, but waits until timeout.

What should i do?

Thanks for help.

[395 byte] By [bobiseka] at [2007-11-27 3:58:45]
# 1
Are you sure the socket is sending multi-lines (I mean really sure) because, assuming 'in' is a BufferedReader, your code WILL read lines if the server is sending lines.
sabre150a at 2007-7-12 9:03:13 > top of Java-index,Core,Core APIs...
# 2
It is FTP server, it sometimes sends one line at time, sometimes more. So how should i read it?
bobiseka at 2007-7-12 9:03:13 > top of Java-index,Core,Core APIs...
# 3
FTP server use two sockets. One for command and one for data. I assume that you are trying to implement and FTP client. Don't bother because there are several good open source Java FTP clients. For one, google for 'jakarta commons net' .
sabre150a at 2007-7-12 9:03:13 > top of Java-index,Core,Core APIs...
# 4

Yes i know, but it is mz school project and i can not use external libraries. I have to do it myself.

I managed to authenticate, but i have problems establishing second socket for data transfer. I dont need all function of FTP i need only get list of files in directory, download one of them and be able to upload to directory. I know the FTP commands , but i am unable to implement this in java. Main problem is as i said establishing second socket.

bobiseka at 2007-7-12 9:03:13 > top of Java-index,Core,Core APIs...
# 5
I have the same problem. Can anybody help us?
Gericopa at 2007-7-12 9:03:13 > top of Java-index,Core,Core APIs...
# 6
If you have the same problem, the solution is also the same.
ejpa at 2007-7-12 9:03:13 > top of Java-index,Core,Core APIs...
# 7
I can't establish the second socket... This is my problem. I need a source code or something. Somebody help me!
Gericopa at 2007-7-12 9:03:13 > top of Java-index,Core,Core APIs...
# 8
> Don't bother because there are several good open source Java FTP clients.
ejpa at 2007-7-12 9:03:13 > top of Java-index,Core,Core APIs...