00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "copyright.h"
00020
00021 #include "system.h"
00022 #include "network.h"
00023 #include "post.h"
00024 #include "interrupt.h"
00025
00026
00027
00028
00029
00030
00031
00032
00033 void
00034 MailTest(int farAddr)
00035 {
00036 PacketHeader outPktHdr, inPktHdr;
00037 MailHeader outMailHdr, inMailHdr;
00038 char *data = "Hello there!";
00039 char *ack = "Got it!";
00040 char buffer[MaxMailSize];
00041
00042
00043
00044
00045 outPktHdr.to = farAddr;
00046 outMailHdr.to = 0;
00047 outMailHdr.from = 1;
00048 outMailHdr.length = strlen(data) + 1;
00049
00050
00051 postOffice->Send(outPktHdr, outMailHdr, data);
00052
00053
00054 postOffice->Receive(0, &inPktHdr, &inMailHdr, buffer);
00055 printf("Got \"%s\" from %d, box %d\n",buffer,inPktHdr.from,inMailHdr.from);
00056 fflush(stdout);
00057
00058
00059
00060 outPktHdr.to = inPktHdr.from;
00061 outMailHdr.to = inMailHdr.from;
00062 outMailHdr.length = strlen(ack) + 1;
00063 postOffice->Send(outPktHdr, outMailHdr, ack);
00064
00065
00066 postOffice->Receive(1, &inPktHdr, &inMailHdr, buffer);
00067 printf("Got \"%s\" from %d, box %d\n",buffer,inPktHdr.from,inMailHdr.from);
00068 fflush(stdout);
00069
00070
00071 interrupt->Halt();
00072 }
The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees