Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c83c0be

Browse files
updated code
1 parent 429739d commit c83c0be

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

‎.idea/workspace.xml

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
153 Bytes
Binary file not shown.

‎src/com/example/hello_world_package/Network_Programming_2.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,19 @@ public static void main(String[] args) {
1313
System.out.println("Protocol: " + url.getProtocol());
1414
System.out.println("Host Name: " + url.getHost());
1515
System.out.println("Port Number: " + url.getPort()); //returns -1 since no port no specified by us in the url
16+
1617
System.out.println("Port Number: " + url.getDefaultPort());//returns default port no for the protocol here for HTTPS 443
18+
1719
System.out.println("File Name: " + url.getFile());
1820

21+
//A URL can optionally specify a "port", which is the port number to which the TCP connection is made on the remote host machine. If the port is not specified, the default port for the protocol is used instead. For example, the default port for http is 80. An alternative port could be specified as:
22+
23+
URL url_next = new URL("http://www.facebook.com:1010/docs/resource1.html");
24+
System.out.println("Port Number for url_next: " + url_next.getPort());
25+
26+
27+
28+
1929
} catch (Exception e) {
2030
System.out.println(e);
2131

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /