Sockets issue
BCS
BCS at pathlink.com
Tue Jan 15 10:21:19 PST 2008
okibi wrote:
>>while (true)
>>{
>> Socket clientSocket = soc.accept();
if it runs to here then you have accepted a connection, if it gets here
a second time, you have accepted a second connection.
>> Stream str = new SocketStream(clientSocket);
>> while(clientSocket.isAlive())
>> {
>> char[] line = str.readLine();
If this is the loop that is not working then I don't think it is a
socket issue. One thing does come to mind, I expect readLine needs to
work with CR/LF sets and as I recall a number of cases (telnet and such)
don't work exactly as I would expect WRT this. Try testing this inner
loop with a file or STDIN.
>> if (line !is null)
>> cmdOpen(line);
>> }
>>}
>
>
> Thanks for the proper code, however it still doesn't allow a 2nd connection, or any after that for that matter. line defines to null.
>
> Any ideas?
More information about the Digitalmars-d-learn
mailing list