1 / 20

Il modello cliente/servente e l’interfaccia Socket per l’implementazione di applicazioni

Il modello cliente/servente e l’interfaccia Socket per l’implementazione di applicazioni. Prof. Alfio Lombardo. Processo A. Processo A. Processo A. Processo B. Processo B. Processo B. Messaggio. Messaggio. IL PROBLEMA DEL RENDEZ-VOUS. Messaggio. Processo A. Processo B. Messaggio.

sara-landry
Download Presentation

Il modello cliente/servente e l’interfaccia Socket per l’implementazione di applicazioni

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Il modello cliente/servente e l’interfaccia Socket per l’implementazione di applicazioni Prof. Alfio Lombardo

  2. Processo A Processo A Processo A Processo B Processo B Processo B Messaggio Messaggio IL PROBLEMA DEL RENDEZ-VOUS

  3. Messaggio Processo A Processo B Messaggio IL PROBLEMA DEL RENDEZ-VOUS Processo A Processo B

  4. CLIENTE CLIENTE CLIENTE SERVENTE SERVENTE Richiesta Risposta MODELLO CLIENTE - SERVENTE

  5. La gestione della concorrenza nel server Cliente Cliente Cliente Remote Login Server INTERNET

  6. CLIENTE 1 SERVENTE MASTER Connessione 2 CLIENTE 2 CLIENTE 1 Connessione 1 SERVENTE SLAVE 1 Richiesta Risposta SERVENTE

  7. SERVENTE CLIENTE Richiesta Risposta LA GESTIONE DEI CRASH NEL SERVER I Scenario: Ack Write

  8. I Scenario: Ack Write SERVENTE CLIENTE Richiesta Risposta No Transaction

  9. II Scenario Write Ack SERVENTE CLIENTE Richiesta Risposta

  10. II Scenario Write Ack SERVENTE CLIENTE Richiesta Richiesta Risposta Duplicate Transaction ?

  11. Ripristino dei guasti nel Server DUP NO OK OK OK OK DUP Ritrasmetti in S0 Ritrasmetti in S0 OK NO NO DUP OK Ritrasmetti in S1 Ritrasmetti OK DUP OK OK DUP DUP Non Ritrasmetti NO OK OK NO OK NO Strategia del Servente Strategia del Cliente Write Ack Write Ack AF(W) AWF F(AW) F(WA) WAF WF(A) S1 = stato di attesa della conferma

  12. POLITICHE DI GESTIONE DEI GUASTI NEL SERVER At mostonce At least once

  13. AP1 AP3 AP2 Funzioni di sistema Kernel del Sistema Operativo contenente il software TCP/UDP L’interfaccia socket

  14. Il concetto di Socket Definizione: Generalizzazione del meccanismo di accesso ai file in Unix che fornisce un punto di accesso per la comunicazione

  15. Appl. process Appl. process Il “canale” di comunicazione tra due Applicativi è rappresentato da: Client port Addr, IP Client Addr, IP Server Addr, Server port Addr Un socket identifica localmente il canale tra due Applicativi

  16. Modalita’ c.o.: Servente Socket( ) socket = socket(family, type, protocol) Bind( ) bind (socket,localaddr,addrlen) family ::= {PF_INET, PF_APPLETALK, PF_PUP, ...} type::= {SOCK_STREAM, SOCK_DGRAM, …..} listen(socket,qlength) Listen( ) Accept( ) newsocket accept(socket,addr,addrlen) fork( ) Fork( ) close(socket) Close( ) recv(sock,*buf,length,flags) Recv( ) Send( ) send(sock,*buf, length,flags) slave master

  17. Modalita’ c.o.: Cliente Connect( ) int connect(socket,destaddr,addrlength ) Recv( ) Socket( ) Send( )

  18. Servente Cliente Socket( ) Bind( ) Socket( ) Listen( ) Connect( ) Accept( ) Send( ) Fork( ) Close( ) Recv( ) Recv( ) Send( ) slave master

  19. Modalita’ c.l. Socket( ) Socket( ) Bind( ) Bind( ) int recvfrom(sock,*buf, length, flags,sourceaddr,addrlength ) RecvFrom( ) RecvFrom( ) SendTo( ) RecvFrom( ) int sendto(sock,*buf, length, flags,destaddr,addrlength ) SendTo( ) Servente Cliente

  20. Esercizio consigliato: IPC Macrolezione 05 (ipermediale) Inter-Process Communication

More Related