Download presentation
Presentation is loading. Please wait.
1
CSE 466 – Fall 2000 - Introduction - 1 AB 2 4 3 1 Chat Application 1 2 3 4 (no event) || (getchar(&c) && !call(c) ) / if (c) echo c, print failure message (getchar(&c) && call(c)) || recv(&c) / echo c, print success message, call accept() if from network (no event) || (getchar(&c) && c!=ESC) || (recv(&c) && (c!= ESC)) / if (c) putchar(c), if from term, send(c). (getchar(&c) && c==ESC) || (recv(&c) && (c== ESC)) / call close(), print message Transport Layer Services: call(); accept(); send(); recv(); close();
2
CSE 466 – Fall 2000 - Introduction - 2 Task Implementation void stateA() _task_ A{ while(1) { if (!avail) wait(K_SIG); avail = 1; if (getchar(&c) && x=call(c)) { sprint( “ connected ” ); avail = 0; os_signal_task(B); } else if (recv(&c) != ESC) { sprint( “ connected ” ); x=accept(); avail = 0; os_signal_task(B); } void stateB() _task_ B { while(1) { if (!busy) wait(K_SIG); busy = 1; if (getchar(&c)) { if (c != ESC) { putchar(c); send(x,c); } else { close(x); busy = 0; os_signal_task(A); } else if (recv(&c)) { if (c != ESC) putchar(c); else { close(x); busy = 0; os_signal_task(A); }
3
CSE 466 – Fall 2000 - Introduction - 3 Complete the Stack User the weather? Transport Physical I2C Transport message semantics / telephone model dial tone ? I2C frames ? Describe the API that the physical layer has to provide to the transport layer. Try writing call(), accept(), send(), recv(), close() functions using that API. Find out what functions you want the physical layer to provide. Application dial tone call() accept() send()… call() accept() send()… connection management / security
4
CSE 466 – Fall 2000 - Introduction - 4 Homework Define the function int call(char c); returns either 0 or a connection number. The connection number should be used when sending or closing as in the following application if (x=call(c)) { send(x,’K’); close(x); }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.