′, 20000)
str = sock.recv(100)
print str
sock.close

Per prima cosa viene caricata la libreria socket con il comando require. L’istruzione sock = TCPSocket.new(’127.0.0.1′, 20000) apre una connessione TCP verso localhost alla porta 2000. L’istruzione str = sock.recv(100) permette di ricevere fino a 100 byte dal sock. Mostriamo la stringa data-ora ricevuta dal server e alla fine chiudiamo il socket.

LEZIONI PRECEDENTI:
29 Agosto 2007: Introduzione
30 Agosto 2007: I numeri
31 Agosto 2007: Le stringhe
3 Settembre 2007: Le variabili
5 Settembre 2007: Le conversioni
12 Settembre 2007: I metodi gets e chomp
17 Settembre 2007: Lo scopo delle variabili
19 Settembre 2007: I nomi
20 Settembre 2007: Il metodo self
21 Settembre 2007: Scrivere un proprio metodo (1/2)
25 Settembre 2007: Scrivere un proprio metodo (2/2)
26 Settembre 2007: Ancora sulle stringhe
28 Settembre 2007: method_missing
2 Ottobre 2007: I costrutti
3 Ottobre 2007: Il range
4 Ottobre 2007: Gli array
8 Ottobre 2007: SMTP class
9 Ottobre 2007: Confronto fra Java e Ruby
10 Ottobre 2007: Interactive Ruby Shell
11 Ottobre 2007: I numeri random
12 Ottobre 2007: Leggere/scrivere file di testo
15 Ottobre 2007: Blocchi e proc
16 Ottobre 2007: Includere altri file

di Satish Talim - Programmazione.it

Segnala su:
Aggiungi 'Corso su Ruby: programmazione socket' a Del.icio.usAggiungi 'Corso su Ruby: programmazione socket' a diggAggiungi 'Corso su Ruby: programmazione socket' a FURLAggiungi 'Corso su Ruby: programmazione socket' a redditAggiungi 'Corso su Ruby: programmazione socket' a Feed Me LinksAggiungi 'Corso su Ruby: programmazione socket' a TechnoratiAggiungi 'Corso su Ruby: programmazione socket' a Yahoo My WebAggiungi 'Corso su Ruby: programmazione socket' a Ma.gnoliaAggiungi 'Corso su Ruby: programmazione socket' a Google BookmarksAggiungi 'Corso su Ruby: programmazione socket' a SegnaloAggiungi 'Corso su Ruby: programmazione socket' a OKnotizieAggiungi 'Corso su Ruby: programmazione socket' a Bookmark.itAggiungi 'Corso su Ruby: programmazione socket' a AskAggiungi 'Corso su Ruby: programmazione socket' a Smarking

Questo post è del giorno Wednesday, October 17th, 2007 delle ore 1:49 am ed appartiene alle categorie Tutorial-HowTo, Dal Mondo..., Programmazione, Generale. Puoi seguire tutti i comenti attraverso il feed RSS 2.0. You can skip to the end and leave a response. Pinging is currently not allowed. 176 Views

1 Star2 Stars3 Stars4 Stars5 Stars (Nessun voto)
Loading ... Loading ...

Un commento a “Corso su Ruby: programmazione socket



Lascia un commento