Skip to content

Commit 4ed8984

Browse files
Update README.md
1 parent df0b5ab commit 4ed8984

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

_moreReadMe/networking/README.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,26 +137,30 @@ A socket is simply an endpoint for communications between the machines. The Sock
137137
![socket-programming](https://user-images.githubusercontent.com/2780145/68625991-64f2e400-0500-11ea-9616-3702cb213cdd.png)
138138

139139
**Important methods :**
140-
|g|g|
140+
|Method|Description|
141141
|-|-|
142-
|h|h|
143-
<table class="alt">
144-
<tbody><tr><th>Method</th><th>Description</th></tr>
145-
<tr><td>1) public InputStream getInputStream()</td><td>returns the InputStream attached with this socket.</td></tr>
146-
<tr><td>2) public OutputStream getOutputStream()</td><td>returns the OutputStream attached with this socket.</td></tr>
147-
<tr><td>3) public synchronized void close()</td><td>closes this socket</td></tr>
148-
</tbody></table>
142+
|void connect(SocketAddress host, int timeout)|connects the socket to the particularized host|
143+
|int getPort()|returns the port to which the socket is pinned on the remote machine|
144+
|InetAddress getInetAddress()|returns the location of the other computer to which the socket is connected|
145+
|int getLocalPort()|returns the port to which the socket is joined on the local machine|
146+
|SocketAddress getRemoteSocketAddress()|returns the location of the remote socket|
147+
|InputStream getInputStream()|returns the input stream of the socket|
148+
|OutputStream getOutputStream()|returns the output stream of the socket|
149+
|synchronized void close()|closes the socket|
149150

150151
### ServerSocket Class :
151152

152153
The ServerSocket class can be used to create a server socket. This object is used to establish communication with the clients.
153154

154155
**Important methods :**
155-
<table class="alt">
156-
<tbody><tr><th>Method</th><th>Description</th></tr>
157-
<tr><td>1) public Socket accept()</td><td>returns the socket and establish a connection between server and client.</td></tr>
158-
<tr><td>2) public synchronized void close()</td><td>closes the server socket.</td></tr>
159-
</tbody></table>
156+
|Method|Description|
157+
|-|-|
158+
|int getLocalPort()|returns the port that the server socket is monitoring on|
159+
|void setSoTimeout(int timeout)|sets the time-out in which the server socket pauses for a client during the accept() method|
160+
|Socket accept()|waits for an incoming client; returns the socket and establish a connection between server and client|
161+
|void bind(SocketAddress host, int backlog)|bind the socket to the particularized server and port in the object of SocketAddress|
162+
|synchronized void close()|closes the server socket|
163+
160164

161165
## Example of Java Socket Programming
162166

0 commit comments

Comments
 (0)