Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Re: [ProgSoc] Java Socket Question .. [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [ProgSoc] Java Socket Question .. To: phil Subject: Re: [ProgSoc] Java Socket Question .. From: Ryan Heise Date: Mon, 8 Feb 1999 22:04:10 +1100 (EST) cc: "The Programmers' Society" In-Reply-To: Reply-To: Ryan Heise Sender: owner-progsoc@nospam.progsoc.uts.edu.au On Mon, 8 Feb 1999, phil wrote: : I have an applet that uses a standard socket (java.net.socket). that : connects to a unix server. : I need to know how to determine when the server side hangs up. : : It is possible to determine if the socket has problems, by trying to : read from the input stream, if a EOF is received then I assume the socket : is closed. However I dont want to periodically read from the input : stream, just to check whether the socket is up. If I try this using : buffered data channel, I lose my position and everything that is waiting : for to be read, after the check. JDK1.1 has limited support for socket options. Unfortunately it does not support SO_KEEPALIVE. Besides, you probably want 1.02 for an applet. I would think the only way to test a connection is to try to send data over the socket and wait for an acknowledgement. Since you can't use SO_KEEPALIVE, you will have to build it into your network protocol. If it sounds like too much trouble, you are probably right. Ryan Heise http://www.progsoc.uts.edu.au/~rheise/ ============================================================================= main(){printf("%d != %d, why?\n", sizeof('"')["'"],(sizeof('"'))["]\"\0["]);} ============================================================================= -- You are subscribed to the progsoc mailing list. To unsubscribe, send a message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au. If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help. This list is archived at References: [ProgSoc] Java Socket Question .. From: phil Prev by Date: Re: [ProgSoc] 2 Celeron 400 vs P2-450 Next by Date: Re: [ProgSoc] 2 Celeron 400 vs P2-450 Prev by thread: [ProgSoc] Java Socket Question .. Next by thread: [ProgSoc] 2 Celeron 400 vs P2-450 Index(es): Date Thread