This is rec_tcp.m in view mode; [Download] [Up]
/* TCP Network Objects -- An example of a receiver by Ian Smith of The Software Engineering Research Center's Multimedia Lab */ #import "tcp.m" main() { id bar; int rt,hisdata,size; char buff[80]; bar = [network_tcp new]; rt=[bar setup:3325]; if (rt!=1) exit(1); while (![bar call_waiting]) { sleep(2); printf("waiting...\n"); } rt=[bar receive]; if (rt!=1) exit(1); rt=[bar recv_text:buff]; printf("%s\n",buff); while (![bar data_waiting]) { sleep(2); printf("waiting for data...\n"); } rt=[bar recv_data:&hisdata ofsize:&size]; if (rt!=1) exit(1); printf("he sent %d which is size:%d\n",hisdata,size); rt=[bar recv_file:"local.file"]; if (rt!=1) exit(1); printf("received the file.\n"); [bar close_tcp]; }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.