27.04.2013 Views

330 Java Tips.pdf - FTP Server

330 Java Tips.pdf - FTP Server

330 Java Tips.pdf - FTP Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Networking<br />

Receive our newsletter with new tips! Almost 6,000 subscribers (by June 2001) can not be wrong!<br />

They read our tips every week! To subscribe to The <strong>Java</strong> FAQ Daily send empty e-mail to:<br />

javafaq-tips-subscribe@topica.com or visit at:<br />

http://www.topica.com/lists/javafaq-tips/<br />

Networking<br />

I have difficulty understanding what is the difference between sockets<br />

and ports. They seem to be doing the same thing, receiving/sending<br />

data streams to other computers over network.<br />

Visit us here and you will find<br />

much more tips!<br />

Answer: A port is a software address on a computer on the network--for instance, the<br />

News server is a piece of software that is normally addressed through port 119,<br />

the POP server through port 110, the SMTP server through port 25, and so on. A<br />

socket is a communication path to a port. When you want your program to<br />

communicate over the network, you have give it a way of addressing the port, and<br />

this is done by creating a socket and attaching it to the port.<br />

basically, socket = IP + ports<br />

Sockets provide acces to the port+ip<br />

We were trying to write a mail client using sun's javamail. I was wondering if there is a way<br />

to set the priority of the message.<br />

Commercial mail clients does this by setting the X-priority: field of the smtp header ( 1<br />

means highest and 5 means lowest - I think the rfc allows much more than this ). Looking at<br />

the documentation I could not find any way. I was wondering if any of you have done anything<br />

similar.<br />

Answer: Look at MimeBodyPart::addHeader(String name, String value);<br />

You can add any headers allowed by the RFC spec. :-)<br />

I am trying socket level programming through firewalls. Could somebody tell what Http<br />

tunnelling is and how to achieve that using <strong>Java</strong> 2?<br />

Answer: As an aside, how do you request your proxy server to fetch a page from the net?<br />

file:///F|/350_t/350_tips/networking.htm (1 of 5) [2002-02-27 21:18:49]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!