NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Ejercicio 3, apartado 1:
El valor final debería ser 10, que realmente ha sido el que ha salido. No han aparecido condiciones de carrera porque nodejs no llega a ejecutar realmente a la vez los clientes en un paralelismo real.

apartado 2:
Que counter se verá como un String, por lo que se irá añadiendo "1"s en forma de strings, no como valor numérico

apartado 3:
function() { //'connect' listener

console.log('Conecting... ' + process.argv[2]);

console.log('client connected');
// This is sent to the server.
client.write('1');
});


Ejercicio 4:
var fs = require('fs');
var http = require('http');
var path= require('path');

http.createServer(function (request, response) {

// response is a ServerResponse.
// Its writeHead() method sets the response header.

response.writeHead(200, {'Content-Type': 'text/plain'});

// The end() method is needed to communicate that both the header
// and body of the response have already been sent. As a result, the response can
// be considered complete. Its optional argument may be used for including the last
// part of the body section.
fs.readFile(path.join(__dirname, request.url) , function(err,data){
if (!err){
console.log('Correct path --> '+path.join(__dirname, request.url));
response.writeHead(200, {"Content-Type": "text/html"});
response.write(data);
response.end();
}else{
response.writeHead(404);
response.end('Bad path --> '+path.join(__dirname, request.url));
}
});
//response.end('Hello Worldn');

// listen() is used in an http.Server in order to start listening for
// new connections. It sets the port and (optionally) the IP address.
}).listen(1337, "127.0.0.1");

console.log('Server running at http://127.0.0.1:1337/');
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.