Skip to main content

Posts

Secure Http

The site can be hosted using secure version of http also, i.e., HTTPS. It sends the information in encrypted form so it's secure. It uses SSL and sends through port number 443 instead of port 80. requires a license/certificate to be purchased to host the site using secured version, i.e., HTTPS.

Handshake in TCP

3 way Handshake: When TCP establishes the connection. Steps followed: 1) SYN packet is sent by A to B with a random sequence number(for initial seq. no.), say SYN 1000 as a request to establish the connection. 2) B sends ACK 1001 indicating to send the packet 1001 assuring the request to be accepted. 3) A sends ACK 1001 to indicate that it has received the request confirmation. 4 Way Handshake: When there's a connection termination then 4 way handshake is used. For termintation of connection in one direction: 1) FIN packet is sent 2) Other party acknowledges it Similar process is followed for connection to end the other way as it's a full duplex connection.

"(ch=in.read)!=-1" not working

While reading through socket's inputStream, you use most of the time "(ch=in.read)!=-1" This thing sometimes doesn't work. So, alternative solution to it is: Append the end of line character at the end of line from the sender's side. Then, use it as terminating condition for loop. End of line can be identified by: '\u0085', '\n', '\r', "\r\n". In my case, it was not working for any other than '\u0085'.

Editor does not contain a main type

If you get an error "editor doesn't contain a main type" in eclipse, solution is : 1) Make sure eclipse created the project as Java project. 2) Just create a new Java project and copy your class into the src folder by import the eventual dependencies and adding all the jar files to it. This should fix the problem.

Implementing cache in mobile (J2ME)

We can maintain cache/history of our visited entries in our mobile. The method that can be used is "RecordStore" how to do it: 1) Open a recordstore 2) add records to it. Note: They'll be stored into mobile memories, you can't see these records as such in mobile Now, when you want to view these records, open the recordstore again if it's closed. just open each record and perform the function. You can append these records in a list so as to show them as a history maintained. Problem welcome...