Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SocketImpl and SocketImplFactory - anyone use these ?


  • From: tug@xxxxxxxxxxxx (John Wilson)
  • Subject: SocketImpl and SocketImplFactory - anyone use these ?
  • Date: Wed, 27 Dec 2000 18:56:41 -0000

----- Original Message -----
From: M. Simms <prosys@xxxxxxxxxxxxxxxx>
To: Advanced-Java List <advanced-java@xxxxxxxxxxxxxxxx>
Sent: 27 December 2000 18:43
Subject: SocketImpl and SocketImplFactory - anyone use these ?


> We want to instantiate a new Socket with a constructor which requires a
> SocketImpl.
>
> Why ? Because we want the Timeout and other options to be set as soon as
the
> socket is created....as many sockets are being created in this app.
>
> However, SocketImpl is abstract and requires the setOption method to be
> overridden......
> there are few examples on how to "fill-in" the guts of setOption.

I think you are taking the wrong approach to this.

You need to subclass Socket and set the options in the constructor:

class MySocket extends Socket {
  public MySocket(Sting host, int port) {
    super(host, port);
    setSoTimeout(....


Then in your program

Socket someSocket = new MySocket(...


John Wilson
The Wilson Partnership
5 Market Hill, Whitchurch, Aylesbury, Bucks HP22 4JB, UK
+44 1296 641072, +44 7976 611010(mobile), +44 1296 641874(fax)




---
To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx