Java socket ??????????
???????????? ???????[ 2015/3/12 14:09:01 ] ????????Java ??????? ???? ??
????2.3 Nagle????????
?????????????????????????????????????????????????????????????????£??????????????
?????????Nagle?????????TCP_NODELAY?????????????????????????????????True?????????Nagle???????????????????????false???????????????????????????л??檔
????3??public final static int SO_BINDADDR = 0x000F;
??????????????????????????????????“????”?“???”?????????????????????????????????????????????
????4??public final static int SO_REUSEADDR = 0x04;
?????????????????????????????á?
????????????????????????????????TCP??λ?? TIME_WAIT ????????????????????????TCP??λ??????????????????????????????????????"???????????"?????????????????????????????????????????????????????? SO_REUSEADDR ????????á????????????????κη????????????????????·????????????????????????????????????????
?????????????????????鹹???Э?顢????????????????????????????SO_REUSEADDR ???????????????????????????????????????????黹??????????????????????????п???????????????????????????? SO_REUSEADDR ??
????5??public final static int SO_BROADCAST = 0x0020;
????????????????????????????????DatagramSocket??????
????6??public final static int IP_MULTICAST_IF = 0x10;
????????????????????????????MulticastSocket?????
??????MulticastSocket???????????????????????
????public void setInterface(InetAddress inf) throws SocketException {
????if (isClosed()) {
????throw new SocketException("Socket is closed");
????}
????checkAddress(inf?? "setInterface");
????synchronized (infLock) {
????getImpl().setOption(SocketOptions.IP_MULTICAST_IF?? inf);
????infAddress = inf;
????}
????}
????7??public final static int IP_MULTICAST_IF2 = 0x1f;
?????????ε?Ч??????????????????????????IPV6
????8??public final static int IP_MULTICAST_LOOP = 0x12;
?????????????????????????????MulticastSocket?????????????????
/**
* Disable/Enable local loopback of multicast datagrams
* The option is used by the platform's networking code as a hint
* for setting whether multicast data will be looped back to
* the local socket.
*
* <p>Because this option is a hint?? applications that want to
* verify what loopback mode is set to should call
* {@link #getLoopbackMode()}
* @param disable <code>true</code> to disable the LoopbackMode
* @throws SocketException if an error occurs while setting the value
* @since 1.4
* @see #getLoopbackMode
*/
public void setLoopbackMode(boolean disable) throws SocketException {
getImpl().setOption(SocketOptions.IP_MULTICAST_LOOP?? Boolean.valueOf(disable));
}
????9??public final static int IP_TOS = 0x3;
?????????????????????IP??е?TOS??ε????????????????IP????·???????Socket??????????????????????
/**
* Sets traffic class or type-of-service octet in the IP
* header for packets sent from this Socket.
* As the underlying network implementation may ignore this
* value applications should consider it a hint.
*
* <P> The tc <B>must</B> be in the range <code> 0 <= tc <=
* 255</code> or an IllegalArgumentException will be thrown.
* <p>Notes:
* <p> For Internet Protocol v4 the value consists of an octet
* with precedence and TOS fields as detailed in RFC 1349. The
* TOS field is bitset created by bitwise-or'ing values such
* the following :-
* <p>
* <UL>
* <LI><CODE>IPTOS_LOWCOST (0x02)</CODE></LI>
* <LI><CODE>IPTOS_RELIABILITY (0x04)</CODE></LI>
* <LI><CODE>IPTOS_THROUGHPUT (0x08)</CODE></LI>
* <LI><CODE>IPTOS_LOWDELAY (0x10)</CODE></LI>
* </UL>
* The last low order bit is always ignored as this
* corresponds to the MBZ (must be zero) bit.
* <p>
* Setting bits in the precedence field may result in a
* SocketException indicating that the operation is not
* permitted.
* <p>
* As RFC 1122 section 4.2.4.2 indicates?? a compliant TCP
* implementation should?? but is not required to?? let application
* change the TOS field during the lifetime of a connection.
* So whether the type-of-service field can be changed after the
* TCP connection has been established depends on the implementation
* in the underlying platform. Applications should not assume that
* they can change the TOS field after the connection.
* <p>
* For Internet Protocol v6 <code>tc</code> is the value that
* would be placed into the sin6_flowinfo field of the IP header.
*
* @param tc an <code>int</code> value for the bitset.
* @throws SocketException if there is an error setting the
* traffic class or type-of-service
* @since 1.4
* @see #getTrafficClass
*/
public void setTrafficClass(int tc) throws SocketException {
if (tc < 0 || tc > 255)
throw new IllegalArgumentException("tc is not in range 0 -- 255");
if (isClosed())
throw new SocketException("Socket is closed");
getImpl().setOption(SocketOptions.IP_TOS?? new Integer(tc));
}
??????????????????TOS???????????Ч??????????????????й????ó?????????TOS???????socket???????????????????TOS???????????ò?????
????10??public final static int SO_LINGER = 0x0080;
???????Socket?????
/**
* Enable/disable SO_LINGER with the specified linger time in seconds.
* The maximum timeout value is platform specific.
*
* The setting only affects socket close.
*
* @param on whether or not to linger on.
* @param linger how long to linger for?? if on is true.
* @exception SocketException if there is an error
* in the underlying protocol?? such as a TCP error.
* @exception IllegalArgumentException if the linger value is negative.
* @since JDK1.1
* @see #getSoLinger()
*/
public void setSoLinger(boolean on?? int linger) throws SocketException {
if (isClosed())
throw new SocketException("Socket is closed");
if (!on) {
getImpl().setOption(SocketOptions.SO_LINGER?? new Boolean(on));
} else {
if (linger < 0) {
throw new IllegalArgumentException("invalid value for SO_LINGER");
}
if (linger > 65535)
linger = 65535;
getImpl().setOption(SocketOptions.SO_LINGER?? new Integer(linger));
}
}
?????????ζ?Socket??close????????????????????????false???close????????в?????????????????δ???????????????????Щ???????????????????????True????????????????????á????????????close??????????е??????????65535??
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Java???????????Щ???????????????Java????????????????Java?б???Map????????Java Web???????????????Java??????????????д?????Java????????7???????????????????????(java .net ?????)???Java??????????Python??????Java webdriver??λ????????′????е?????Java??д??????????????????Java???????????????JavaScript????????????Java?????????????????? Java???????10??????????????Java?м????????????????java???????ü???????????м???????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????