// SMTP
var text = "";
var protokollaTila = -1;
var hosts = {
"h1": "SMTP_Asiakas",
"h2": "SMTP_Palvelin"
};
var synArray = new Array("Avataanko yhteys? (TCP SYN)", "Avataan yhteys, ok? (TCP SYNACK)", "OK! (TCP ACK)");
var smtpArray = new Array("220 ITKP104 Postipalvelin", "HELO mie here!", "250 ITKP104 Postipalvelin HELO", "MAIL FROM: mie", "250 2.1.0 Sender... mie you are ok", "RCPT TO: sie", "250 2.1.5 Recipient... sie is ok!", "DATA", "354 Enter mail, end with [piste omalla rivillä]", "lalalalala [piste omalla rivillä]", "250 2.0.0 sähköposti lähti!", "QUIT", "221 2.0.0 ITKP104 Postipalvelin sulkeepi yhteyden...");
var finArray = new Array("Suljetaanpa yhteys (TCP FIN)", "Suljetaan yhteys (TCP FIN)", "Okei! (TCP ACK)", "Ookoo! (TCP ACK)");
$(document).ready(function() {
alusta();
piirra();
$('a').click(function(event) {
var tila = this.id;
switch (tila) {
case "smtp":
switch (protokollaTila) {
case -1:
$('#smtp').fadeOut(500);
$('#smtp').fadeIn(500, function() {
$('#smtp').html('Seuraava viesti');
});
protokollaTila += 1;
break;
case 0:
case 2:
piirra_nuoli("h1", "h2", synArray[protokollaTila]);
protokollaTila += 1;
break;
case 1:
piirra_nuoli("h2", "h1", synArray[protokollaTila]);
protokollaTila += 1;
break;
case 3:
case 5:
case 7:
case 9:
case 11:
case 13:
case 15:
piirra_nuoli("h2", "h1", smtpArray[protokollaTila - 3]);
protokollaTila += 1;
break;
case 4:
case 6:
case 8:
case 10:
case 12:
case 14:
piirra_nuoli("h1", "h2", smtpArray[protokollaTila - 3]);
protokollaTila += 1;
break;
case 16:
case 18:
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.