main main Makefile Makefile C.5 Makefile Makefile Makefile A Mech (TA ) 1. Web ( iku

Size: px
Start display at page:

Download "main main Makefile Makefile C.5 Makefile Makefile Makefile A Mech (TA ) 1. Web (http://www.jsk.t.u-tokyo.ac.jp/ iku"

Transcription

1 ikuo/enshu/keisanki/ my_sound.c, my_sounc.h, play.c, record.c

2 main main Makefile Makefile C.5 Makefile Makefile Makefile A Mech (TA ) 1. Web ( ikuo/ enshu/keisanki/) chat-appli2.tar.gz % tar xvzf chat-appli2.tar.gz % cd chat-appli/sound/ chat-appli/sound/ (Makefile, my sound.h, my sound.c, play.c, record.c) (chat-appli/device1/sound/sample1.c Makefile) 2. make./record./play play.c record.c 1 ver10.pdf

3 3 3 IP( ) IP IP 3.1 IP IP IP ( ) (8 ) 4 2 IP IP IP IP 3 13B PC IP mechpc37 IP IP IP ( IP ) FQDN (FQDN = Fully Qualified Domain Name) jsk.t.u-tokyo.ac.jp ( ) www DNS ( ) IP ( IP ) DNS(Domain Name System) DNS IP IP nslookup 5 DNS IP G 3 IP mech-gw.mech.t.u-tokyo.ac.jp mech-gw.mech.t.u-tokyo.ac.jp 5 dig

4 4 3. % nslookup Server: xxx Address: xxx.xxx.xxx.xxx Name: Address: IP xxx.xxx.xxx.xxx % nslookup xxx.xxx.xxx.xxx IP IP( ) IP (16bit) (TA ) 1. nslookup IP 2. IP FQDN 3. telnet 80 % telnet 80 GET /index.html /HTTP1.1 <ENTER><ENTER>...

5 5 4 ( ) UNIX C (API) read, write open socket() connect() socket() IP bind() socket() IP listen() bind() IP accept() bind() listen() read(), write() 4.1 socket(): socket socket ( ) mech-unix % man socket socket #include <sys/socket.h> int socket(int socket_family, int type, int protocol); socket_family : PF_INET socket_type protocol : SOCK_STREAM TCP : 0 : connect(): socket connect mech-unix % man connect

6 6 4. ( ) connect #include <sys/socket.h> int connect(int s, struct sockaddr_in *serv_addr, int len); s : (socket ) serv_addr : (IP ) len : serv_addr( ) : (0) (-1) serv_addr (IP ) len struct sockaddr_in s read write 4.3 struct sockaddr in struct sockaddr_in struct sockaddr { }; short sin_family; // PF_INET unsigned short sin_port; struct in_addr sin_addr; // // IP 3 (TA ) 1. 1 chat-appli/socket/ client.c my socket.c client.o my socket.o client Makefile A chat-appli/sound/makefile (C.5 ) 2. client.c./client

7 7 5 ( ) 5.1 bind(): IP #include <sys/socket.h> int bind(int s, struct sockaddr *my_addr, socklen_t len); s my_addr len : : IP : my_addr( ) : (0) (-1) socket() ( ) IP sockaddr_in listen(): ( ) ) #include <sys/socket.h> int listen(int s, int backlog); s backlog : : : (0) (-1) ( ) backlog backlog 1 accept(5.3 )

8 8 5. ( ) 5.3 accept(): #include <sys/socket.h> int accept (int s, struct sockaddr_in *addr, int *addrlen); s addr OK) addrlen : : ( NULL : ( NULL OK) : -1 4 (TA ) 1. 3 Makefile server.o my socket.o server make client server 2. server.c ( ) server.c Kbyte 1byte read write ( ) 256byte write byte my socket.c(b.1) socket_read() socket_write()

9 (TA ) text_chat_server text_chat_client q my socket.c socket_write() socket_read() read() write read() write IP IP (char*) (int) int atoi(const char *str); chat-appli/socket/ make ( ) Makefile 1. IP /index.html GET 2. IP gethostbyname() 3.

10 10 A. Makefile A Makefile A.1 Makefile Makefile : make ( ) test1 main.c hello.c test1.exe: main.c hello.c gcc -o test1.exe main.c hello.c % make test1.exe gcc -o test1.exe main.c hello.c A.2 hello.c main.c main.c main.o, hello.c hello.o Makefile test2 hello.o main.o hello.c make test2 hello.c main.c test2.exe: main.o hello.o main.o: main.c hello.o: hello.c gcc -o test2.exe main.o hello.o gcc -o main.o -c main.c gcc -o hello.o -c hello.c A.3

11 A test3.exe: main.o hello.o gcc -o $^ main.o: main.c gcc -o -c $^ hello.o: hello.c gcc -o -c $^ $^ makefile $% $ $? $ $+ Makefile $*.c.o.c.o: gcc -o $@ -c $< %.o: %.c gcc -o $@ -c $< Makefile test4.exe: main.o hello.o %.o: %.c gcc -o $@ $^ gcc -o $@ -c $< Makefile ac.jp/ k-okada/makefile/

12 12 B. B B.1 my socket.c 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <unistd.h> 4 #include <string.h> 5 6 #include "my_socket.h" 7 8 // // socket_open (client) 10 // int 12 socket_open (const char* ip_addr, int port) 13 { 14 struct sockaddr_in sin; 15 int sock; // 18 // if ((sock = socket(pf_inet, SOCK_STREAM, 0)) < 0) { 20 perror("client: socket"); 21 exit(1); 22 } // 25 // sin.sin_family = PF_INET; // 96 return buf_size - left_size; (PF_INET ) 27 sin.sin_port = htons(port); // 28 sin.sin_addr.s_addr = inet_addr(ip_addr); // // 31 // if ((connect(sock, (struct sockaddr *)&sin, 33 sizeof(sin))) < 0) { 34 perror("client: connect"); 35 exit(1); 36 } return sock; 39 } // // if ((s = socket(pf_inet, SOCK_STREAM, 0)) < 0) { 42 // socket_close 114 perror("server: socket"); 43 // exit(1); 44 int 116 } 45 socket_close(int sock) { 118 bzero( (char *)&sin, sizeof(struct sockaddr) ); 47 shutdown (sock, SHUT_RDWR); return close( sock ); 120 sin.sin_family = PF_INET; 49 } 121 sin.sin_port = htons(port); sin.sin_addr.s_addr = htonl(inaddr_any); 51 // // socket_read 124 if ((bind(s, (struct sockaddr *)&sin, sizeof(sin))) < 0) { 53 // perror("server: bind"); 54 int 126 exit(1); 55 socket_read( int sock, void* buf, int buf_size ) 127 } 56 { int size; 129 // 58 int left_size = buf_size; 130 // char* p = (char*) buf; 131 if ((listen(s, 10)) < 0) { perror("server: listen"); 61 // 133 exit(1); 62 // 134 } 63 // while( left_size > 0 ) { 65 size = read(sock, p, left_size); 66 p += size; 67 left_size -= size; if( size <= 0 ) break; 70 } return buf_size - left_size; 73 } // // socket_write 77 // int 79 socket_write( int sock, void* buf, int buf_size ) 80 { 81 int size; 82 int left_size = buf_size; 83 char* p = (char*) buf; // 86 // 87 // while( left_size > 0 ) { 89 size = write(sock, p, left_size); 90 p += size; 91 left_size -= size; if( size <= 0 ) break; 94 } } // // init_socket_server 103 // port 104 // int 106 init_socket_server( int port ) 107 { 108 int s; 109 struct sockaddr_in sin; // printf("waiting for connection\n"); return s; } 141

13 B.2. my socket.h 13 B.2 my socket.h 1 #ifndef _MY_SOCKET_H_ 2 #define _MY_SOCKET_H_ 3 4 #include <sys/types.h> 5 #include <sys/socket.h> 6 #include <netinet/in.h> 7 #include <arpa/inet.h> extern int socket_open(const char* ip_addr, int port); 11 extern int socket_close(int sock); 12 extern int socket_read(int sock, void* buf, int buf_size ); 13 extern int socket_write(int sock, void* buf, int buf_size ); 14 extern int init_socket_server( int port ); #endif /* _MY_SOCKET_H_ */ B.3 client.c ( ) 1 // // client.c 3 // #include <stdio.h> 6 #include <stdlib.h> 7 #include <string.h> 8 #include <unistd.h> 9 10 #include "my_socket.h" #define PORT //TODO // // main 16 // int main(int argc, char *argv[]) 18 { 19 char *str = "GET /index.html / HTTP/1.1\n\n"; 20 char buf[bufsiz]; 21 int sock, ret; if(argc == 1){ 24 printf("usage: client <server IP address>\n"); 25 exit(1); 26 } // 29 // sock = socket_open( argv[1], PORT ); 31 // argv[1] argv[0] // 34 socket_write ( /*TODO*/, str, strlen(str) ); 35 printf ( "Sent:\n%s\n", str ); do { 38 // 39 ret = read ( /*TODO*/, buf, BUFSIZ ); 40 printf ( "Received(%d):\n%s\n", ret, buf ); 41 } while (ret>0); socket_close (sock); return 0; 46 } B.4 server.c ( ) 1 // // server.c 3 // #include <stdio.h> 6 #include <stdlib.h> 7 #include <unistd.h> 8 9 #include "my_socket.h" #define PORT // // main 15 // int 17 main() 18 { 19 int s, ns; 20 char buf[bufsiz]; 21 int ret; // 24 s = init_socket_server(port); // accept 27 // if ((ns = accept(s, NULL, 0)) < 0) { 29 perror("server: accept"); 30 exit(1); 31 } 32 printf("connected : %d\n", ns); // 35 ret = /*???*/ (/*???*/, buf, BUFSIZ); 36 printf ("Received from client (%d bytes):\n%s\n", ret, buf); // 39 ret = /*???*/ (/*???*/, buf, ret); 40 printf ("Sent to client (%d bytes)\n", ret); // 43 socket_close (ns); // 46 close (s); return 0; 49 }

14 14 C. C C.1 play.c 1 #include <stdio.h> 2 3 #include "my_sound.h" 4 5 #define RATE DEFAULT_RATE 6 7 // to try test.raw, uncomment below two lines 8 //#define RATE //#define SIZE // 11 // 54 sound_dev_open ( SOUND_DEV_FILENAME, w, snd_data ); 12 int 13 load_sound_data ( const char *filename, 14 SOUND_DATA *snd, int max_length ) 15 { 16 FILE *fp; 17 int length, ret; // 19 // 62 sound_set_channels ( CHANNELS, snd_data ); 20 if ( (fp=fopen(filename, "rb")) == NULL) { 21 perror("file open failed"); 22 return -1; 23 } 24 // 25 length = max_length*snd->rate*snd->channels; 26 if (length > snd->buf_size) 27 length = snd->buf_size; 70 length = load_sound_data ( filename, snd_data, MAX_LENGTH ); 28 // 71 printf ( "%s: duration is %f [s]\n", filename, 29 ret = fread (snd->buf, snd->bits/8, length, fp); 72 (double)length/snd_data->rate/snd_data->channels ); 30 // 73 snd_data->buf_size = length*(snd_data->bits/8); 31 fclose (fp); 32 // 33 return ret; 34 } int 38 main(int argc, char *argv[]) 39 { 40 // 41 SOUND_DATA* snd_data; 42 // 43 int length; 44 // 45 char *filename="test.raw"; // 48 if ( argc > 1 ) filename = argv[1]; // 51 snd_data = sound_create ( MAX_LENGTH * RATE * 52 (SIZE / 8) * CHANNELS ); //=================================================== 57 // 58 //=================================================== 59 // 60 sound_set_bits ( SIZE, snd_data ); 63 // 64 sound_set_rate ( RATE, snd_data ); //=================================================== 68 // 69 //=================================================== //=================================================== 76 // 77 //=================================================== 78 sound_play ( snd_data ); // 82 sound_dev_close ( snd_data ); return 0; 85 } C.2 record.c 1 #include <stdio.h> 2 3 #include "my_sound.h" 4 5 #define RATE DEFAULT_RATE // 30 int main(int argc, char *argv[]) 6 #define LENGTH 5 // ( ) 31 { 7 32 // 8 // buf[] 33 SOUND_DATA* snd_data; 9 int save_sound_data ( const char *filename, 10 SOUND_DATA *snd, int length ) 11 { 12 FILE *fp; 13 int ret; // 15 // 40 if ( argc > 1 ) filename = argv[1]; 16 if ( (fp=fopen(filename, "wb")) == NULL) { 17 perror("file open failed"); 18 return -1; 19 } 44 // 20 // 45 sound_dev_open ( SOUND_DEV_FILENAME, r, snd_data ); 21 ret = fwrite (snd->buf, snd->bits/8, 22 length*snd->rate*snd->channels, fp); 47 //=================================================== 23 // 48 // 24 fclose (fp); 25 // 26 return ret; 27 } // 35 int length; 36 // 37 char *filename="test.raw"; // 43 snd_data = sound_create ( LENGTH * RATE * (SIZE / 8) * CHANNELS ); //=================================================== 50 //

15 C.3. my sound.h sound_set_bits ( SIZE, snd_data ); 63 //=================================================== 52 // 64 // 53 sound_set_channels ( CHANNELS, snd_data ); 65 //=================================================== 54 // 66 length = save_sound_data ( filename, snd_data, LENGTH ); 55 sound_set_rate ( RATE, snd_data ); 67 printf ( "%s: saved the file (%d)\n", filename, LENGTH ); //=================================================== 70 // 59 // 71 sound_dev_close ( snd_data ); 60 //=================================================== sound_record ( snd_data ); return 0; 74 } C.3 my sound.h 1 #ifndef _MY_SOUND_H_ 2 #define _MY_SOUND_H_ 3 4 // 5 #define SOUND_DEV_FILENAME "/dev/dsp" 6 7 #define MAX_LENGTH 30 // ( ) ( ) 37 int sound_dev_close( SOUND_DATA* snd_data ); 8 #define DEFAULT_RATE // 38 9 #define SIZE 16 // 39 int sound_set_bits( const int bits, 10 #define CHANNELS 2 // (2=stereo) /* */ 13 typedef struct { 14 int fd; int bits; 17 int rate; 18 int channels; int buf_size; 21 char* buf; 22 } SOUND_DATA; #ifdef cplusplus 25 extern "C" 26 { 27 #endif SOUND_DATA* sound_create( int size ); int sound_release( SOUND_DATA* snd_data ); int sound_dev_open( const char* dev_filename, 34 const char r_or_w, 35 SOUND_DATA* snd_data ) ; SOUND_DATA* snd_data ); int sound_set_channels( const int channels, 43 SOUND_DATA* snd_data ); int sound_set_rate( const int rate, 46 SOUND_DATA* snd_data ); int sound_play( SOUND_DATA* snd_data ); int sound_play_stop(); int sound_record( SOUND_DATA* snd_data ); int sound_record_stop(); #ifdef cplusplus 57 } 58 #endif #endif C.4 my sound.c 1 #include <stdlib.h> 2 #include <stdio.h> 3 #include <string.h> 4 #include <unistd.h> 5 #include <fcntl.h> 6 #include <sys/types.h> 7 #include <sys/ioctl.h> 8 9 #ifdef Cygwin 10 #include <sys/soundcard.h> 11 #else 12 #include <linux/soundcard.h> 13 #endif #include "my_sound.h" static int flg_play = 0; 18 static int flg_record = 0; // // sound_create 22 // SOUND_DATA* 24 sound_create( int size ) 25 { SOUND_DATA* result; result = (SOUND_DATA *) malloc( sizeof(sound_data) ); 30 if(!result ) { 31 fprintf(stderr, "cannot allocate sound data\n"); 32 return 0; 33 } result->buf = (char*) malloc( size ); 36 if(!result->buf ) { 37 fprintf(stderr, "cannot allocate sound buffer\n"); 38 return 0; 39 } 40 result->buf_size = size; result->fd = 0; result->bits = 0; 45 result->rate = 0; 46 result->channels = 0; return result; 49 } 50

16 16 C. 51 // } 52 // sound_release // snd_data->bits = val; 54 int sound_release( SOUND_DATA* snd_data ) 137 return 0; 56 { 138 } 57 if( snd_data ) { free(snd_data->buf); 140 // free(snd_data); 141 // sound_set_channels 60 } 142 // int 62 snd_data = NULL; 144 sound_set_channels( const int channels, SOUND_DATA* snd_data ) 64 return 0; 146 { 65 } 147 int val; // val = channels; 68 // sound_dev_open // if(!snd_data->fd ) return -1; 70 int 71 sound_dev_open( const char* dev_filename, 72 const char r_or_w, 73 SOUND_DATA* snd_data ) 74 { 75 int mode = 0; switch(r_or_w) { 78 case r : 79 mode = O_RDONLY; 80 break; 81 case w : 82 mode = O_WRONLY; 83 break; 84 default: 85 return -1; 86 } snd_data->fd = open(dev_filename, mode ); 89 if(snd_data->fd <= 0){ 171 int val; 90 fprintf( stderr, "open of %s failed", dev_filename 172); 91 return -1; 92 } return 0; 95 } // &val) == -1) { 179 perror("sound_pcm_write_rate ioctl failed"); 98 // sound_dev_close 180 return 0; 99 // } 100 int sound_dev_close( SOUND_DATA* snd_data ) 183 snd_data->rate = val; 102 { return 0; 104 if( snd_data->fd > 0 ) { 186 } if( close(snd_data->fd) == -1 ){ 188 // fprintf( stderr, "device close failed" ); 189 // sound_play 108 return -1; 190 // } 191 int 110 } 192 sound_play( SOUND_DATA* snd_data ) { 112 snd_data->fd = 0; 194 char* bufp; int left_size; 114 return 0; } 197 flg_play = 1; left_size = snd_data->buf_size; 117 // // sound_set_bits 200 bufp = (char *)snd_data->buf; 119 // int 121 sound_set_bits( const int bits, 122 SOUND_DATA* snd_data ) 123 { 124 int val; val = bits; if(!snd_data->fd ) return -1; } 130 if ( ioctl(snd_data->fd, SOUND_PCM_WRITE_BITS, &val) 212== -1){ 131 perror("sound_pcm_write_bits ioctl failed"); 132 return -1; if ( ioctl(snd_data->fd, SOUND_PCM_WRITE_CHANNELS, 154 &val) == -1) { 155 perror("sound_pcm_write_channels ioctl failed"); 156 return -1; 157 } snd_data->channels = val; return 0; 162 } // // sound_set_rate 166 // int 168 sound_set_rate( const int rate, 169 SOUND_DATA* snd_data ) 170 { 173 val = rate; if(!snd_data->fd ) return -1; if ( ioctl(snd_data->fd, SOUND_PCM_WRITE_RATE, 202 while (left_size>0 && flg_play ) { int written_size; written_size = write(snd_data->fd, bufp, 207 sizeof(short)*snd_data->channels ); 208 if (written_size==-1) { 209 fprintf(stderr, "wrote wrong number of bytes"); 210 return -1; 213 left_size -= written_size; 214

17 C.5. Makefile: bufp += written_size; } 250 bufp = (char *)snd_data->buf; while ( left_size>0 && flg_record > 0 ) { 218 // ioctl( snd_data->fd, SOUND_PCM_RESET ); 252 int read_size; 219 flg_play = 0; read_size = read(snd_data->fd, bufp, 221 return 0; 255 sizeof(short)*snd_data->channels ); 222 } 256 if (read_size==-1) { fprintf( stderr, "read wrong number of bytes" ); 224 // return -1; 225 // sound_play_stop 259 } 226 // int 228 sound_play_stop() 229 { 230 flg_play = 0; return 0; 233 } // return 0; 236 // sound_record 270 } 237 // int 239 sound_record( SOUND_DATA* snd_data ) 240 { 241 int left_size; 242 char* bufp; flg_record = 1; left_size = snd_data->buf_size; snd_data->buf_size = 0; 261 snd_data->buf_size += read_size; 262 left_size -= read_size; 263 bufp += read_size; 264 } //ioctl( snd_data->fd, SOUND_PCM_RESET ); 267 flg_record = 0; 272 // // sound_record_stop 274 // int 276 sound_record_stop() 277 { 278 flg_record = 0; return 0; 281 } C.5 Makefile: 1 # Makefile 2 3 CC = gcc 4 CXX = g++ 5 RM = rm -f 6 7 # C 8 CFLAGS = -g -Wall -O # ( ) 11 LDFLAGS = -g -O TARGET = play record %.o: %.c 16 ${CC} -c ${CFLAGS} $< 17 %.o: %.cpp 18 ${CC} -c ${CXXFLAGS} $< all: ${TARGET} ${TARGET}: 23 ${CXX} -o $@ $^ ${LDFLAGS} play: play.o my_sound.o 26 record: record.o my_sound.o clean: 29 $(RM) *.o 30 $(RM) $(TARGET) $(addsuffix.exe, $(TARGET)) 31 $(RM) *~

演算増幅器

演算増幅器 ネットワークプログラミング ( 教科書 p.247-312) これまでに作成したプログラムは 1 台のコンピュータ上で動作するものだった 本日はネットワーク上の別のコンピュータで実行しているプログラムと通信をしながら動作するプログラムの作成方法について学ぶ ネットワークプログラミングを高度に使いこなすためには 関連する知識は幅広く求められる 本日からの学習では単純なチャット ( 会話 ) を行うプログラムを題材として

More information

untitled

untitled RPC (( Remote Procedure Call (RPC: Message-Oriented Middleware (MOM) data-streaming =(protocol) A B A B Connection protocol = connection oriented protocol TCP (Transmission Control Protocol) connectionless

More information

IP L09( Tue) : Time-stamp: Tue 14:52 JST hig TCP/IP. IP,,,. ( ) L09 IP (2017) 1 / 28

IP L09( Tue) : Time-stamp: Tue 14:52 JST hig TCP/IP. IP,,,. ( )   L09 IP (2017) 1 / 28 L09(2017-11-21 Tue) : Time-stamp: 2017-11-21 Tue 14:52 JST hig TCP/IP. IP,,,. http://hig3.net L09 (2017) 1 / 28 9, IP, - L09 (2017) 2 / 28 C (ex. ) 1 TCP/IP 2 3 ( ) ( L09 (2017) 3 / 28 50+5, ( )50+5. (

More information

ikuo/enshu/keisanki/ GUI(Graphica

ikuo/enshu/keisanki/ GUI(Graphica 2008 (mizuuchi@i.u-tokyo.ac.jp) http://www.jsk.t.u-tokyo.ac.jp/ http://www.jsk.t.u-tokyo.ac.jp/ ikuo/enshu/keisanki/ 2008 5 16 6 23 1 2 1 GUI(Graphical User Interface) 2 2.1 CD USB ( LSI ) (hardware abstraction)

More information

3 3.1 LAN ISDN (IP) 2 TCP/UDP IP IP IP IP (Ethernet) Ethernet LAN TCP/UDP LAN Ethernet LAN 2: Ethernet ATM, FDDI, LAN IP IP IP 3 IP 2 IP IP IP IP IP 3

3 3.1 LAN ISDN (IP) 2 TCP/UDP IP IP IP IP (Ethernet) Ethernet LAN TCP/UDP LAN Ethernet LAN 2: Ethernet ATM, FDDI, LAN IP IP IP 3 IP 2 IP IP IP IP IP 3 IP 1 (IP) TCP/IP 1 2 2 1 LAN IP C IP 192.168.0.101 192.168.0.104 HUB 100Base-TX 100Mbps UTP Ethernet HUB 192.168.0.101 192.168.0.102 192.168.0.103 192.168.0.104 1: 6 1 3 3.1 LAN ISDN (IP) 2 TCP/UDP IP

More information

double float

double float 2015 3 13 1 2 2 3 2.1.......................... 3 2.2............................. 3 3 4 3.1............................... 4 3.2 double float......................... 5 3.3 main.......................

More information

1 telnet WWW 1.1 telnet WWW URL html 1.2 URL 1 % telnet 80 Trying 2001:2f8:1c:d048::850d: telnet: c

1 telnet WWW 1.1 telnet WWW URL html 1.2 URL 1   % telnet   80 Trying 2001:2f8:1c:d048::850d: telnet: c 2 065708F 2007 12 20 1 1 telnet WWW 1.1 telnet WWW URL html 1.2 URL 1 www.ie.u-ryukyu.ac.jp % telnet www.ie.u-ryukyu.ac.jp 80 Trying 2001:2f8:1c:d048::850d:3008... telnet: connect to address 2001:2f8:1c:d048::850d:3008:

More information

エラー処理・分割コンパイル・コマンドライン引数

エラー処理・分割コンパイル・コマンドライン引数 L10(2017-12-05 Tue) : Time-stamp: 2017-12-17 Sun 11:59 JST hig. recv/send http://hig3.net ( ) L10 (2017) 1 / 21 IP I swallow.math.ryukoku.ac.jp:13 = 133.83.83.6:13 = : IP ( = ) (well-known ports), :. :,.

More information

演算増幅器

演算増幅器 ネットワークプログラミングの続き前回はチャットを行うプログラムを作成し ネットワークを利用したプログラミングの基本について学んだ 本日は 前回作成したプログラムを改良していく 具体的には 以下の2つの項目について習っていく ホスト名や IP アドレスの取得の方法 fork() システムコールを使い 子プロセスを作成する方法 チャットプログラムの改良 前回のプログラムを以下のように改良していく 太字部分が変更部分である

More information

TCP UDP TCP UDP send()sendto()sendmsg() recv()recvfrom()recvmsg() OS Passive Active TCP UDP IP TCP UDP MTAMail Transf

TCP UDP TCP UDP send()sendto()sendmsg() recv()recvfrom()recvmsg() OS Passive Active TCP UDP IP TCP UDP MTAMail Transf 3 -- 7 2011 2 TCPUDP APIApplication Programming Interface BSD UNIX C System V UNIX XTIX /Open Transport Interface XTI TCP/IP ISO OSI XTI TCP/IP OSI TCP UDP API API API API UNIX Windows 7-1 TCP UDP 7-2

More information

Makefile, TCPソケットサーバ, コマンドライン引数

Makefile, TCPソケットサーバ, コマンドライン引数 L11(2017-12-12 Tue) : Time-stamp: 2017-12-22 Fri 12:28 JST hig ( ) make http://hig3.net L11 (2017) 1 / 24 I, void die(char message) void die(char message[])... 1 #i n c l u d e 2 / / 3 double

More information

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n 2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test

More information

第5回お試しアカウント付き並列プログラミング講習会

第5回お試しアカウント付き並列プログラミング講習会 qstat -l ID (qstat -f) qscript ID BATCH REQUEST: 253443.batch1 Name: test.sh Owner: uid=32637, gid=30123 Priority: 63 State: 1(RUNNING) Created at: Tue Jun 30 05:36:24 2009 Started at: Tue Jun 30 05:36:27

More information

II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y

II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C 1 6 9 1 main main 1 NULL NULL 1 15 23 25 48 26 30 32 36 38 43 45 47 50 52 for 2 (a) 2 2 1 Yacc 2 (b) 2 3 yytext tmp2 ("") tmp2->next->word tmp2 yytext tmp2->next->word

More information

program.dvi

program.dvi 2001.06.19 1 programming semi ver.1.0 2001.06.19 1 GA SA 2 A 2.1 valuename = value value name = valuename # ; Fig. 1 #-----GA parameter popsize = 200 mutation rate = 0.01 crossover rate = 1.0 generation

More information

Condition DAQ condition condition 2 3 XML key value

Condition DAQ condition condition 2 3 XML key value Condition DAQ condition 2009 6 10 2009 7 2 2009 7 3 2010 8 3 1 2 2 condition 2 3 XML key value 3 4 4 4.1............................. 5 4.2...................... 5 5 6 6 Makefile 7 7 9 7.1 Condition.h.............................

More information

untitled

untitled Message Oriented Communication Remote Procedure Call (RPC: Message-Oriented Middleware (MOM) data-streaming persistent communication transient communication asynchronous communication synchronous communication

More information

橡Pro PDF

橡Pro PDF 1 void main( ) char c; /* int c; */ int sum=0; while ((c = getchar())!= EOF) if(isdigit(c) ) sum += (c-'0'); printf("%d\n", sum); main()int i,sum=0; for(i=0;i

More information

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l C/C++ 2007 6 18 1 C STL(1) 2 1.1............................................... 2 1.2 stdio................................................ 3 1.3.......................................... 10 2 11 2.1 sizeof......................................

More information

lexex.dvi

lexex.dvi (2018, c ) http://istksckwanseiacjp/ ishiura/cpl/ 4 41 1 mini-c lexc,, 2 testlexc, lexc mini-c 1 ( ) mini-c ( ) (int, char, if, else, while, return 6 ) ( ) (+, -, *, /, %, &, =, ==,!=, >, >=,

More information

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou 1 1.1 C 2 1 double a[ ][ ]; 1 3x3 0 1 3x3 ( ) 0.240 0.143 0.339 0.191 0.341 0.477 0.412 0.003 0.921 1.2 malloc() 2 double *a[ ]; double 1 malloc() double 1 malloc() free() 3 #include #include

More information

r07.dvi

r07.dvi 19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1

More information

ohp07.dvi

ohp07.dvi 19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5

More information

CM-3G 周辺モジュール拡張技術文書 MS5607センサ(温度、気圧)

CM-3G 周辺モジュール拡張技術文書 MS5607センサ(温度、気圧) CM-3G 周辺モジュール拡張技術文書 MS5607 センサ ( 温度 気圧 ) ( 第 1 版 ) Copyright (C)2016 株式会社コンピューテックス 目次 1. はじめに... 1 2. MS5607 について... 1 3. 接続図... 1 4. アプリケーション ソース... 2 5. アプリケーションのコンパイル方法... 7 6. アプリケーションの実行... 8 1. はじめに

More information

新・明解C言語 実践編

新・明解C言語 実践編 第 1 章 見 21 1-1 見えないエラー 見 List 1-1 "max2x1.h" a, b max2 List 1-1 chap01/max2x1.h max2 "max2x1.h" #define max2(a, b) ((a) > (b)? (a) : (b)) max2 List 1-2 List 1-2 chap01/max2x1test.c max2 #include

More information

新版明解C言語 実践編

新版明解C言語 実践編 2 List - "max.h" a, b max List - max "max.h" #define max(a, b) ((a) > (b)? (a) : (b)) max List -2 List -2 max #include "max.h" int x, y; printf("x"); printf("y"); scanf("%d", &x); scanf("%d", &y); printf("max(x,

More information

Microsoft Word - EGX100によるH663通信手引

Microsoft Word - EGX100によるH663通信手引 PowerLogic EthernetGateway(EGX100) による H663 データ取得早分かり手引き 2011 年 11 月 11 日 JAVASYS 1. 概要 H663 は RS-485 によって上位機と通信し データのやりとりを行います 本仕様書は PowerLogic EthernetGateway(EGX100) によるデータ取得の開発に関して簡単な手引きを記述します EGX100

More information

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include 1 1.1 C 2 1 double a[ ][ ]; 1 3x3 0 1 3x3 ( ) 0.240 0.143 0.339 0.191 0.341 0.477 0.412 0.003 0.921 1.2 malloc() malloc 2 #include #include #include enum LENGTH = 10 ; int

More information

ARM gcc Kunihiko IMAI 2009 1 11 ARM gcc 1 2 2 2 3 3 4 3 4.1................................. 3 4.2............................................ 4 4.3........................................

More information

r08.dvi

r08.dvi 19 8 ( ) 019.4.0 1 1.1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( ) 1 next 1 prev 1 head cur tail head cur prev

More information

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( )

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) 2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test

More information

ohp08.dvi

ohp08.dvi 19 8 ( ) 2019.4.20 1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: 2 (2) NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( 2) 3 (3) head cur tail head cur prev data

More information

slide5.pptx

slide5.pptx ソフトウェア工学入門 第 5 回コマンド作成 1 head コマンド作成 1 早速ですが 次のプログラムを head.c という名前で作成してください #include #include static void do_head(file *f, long nlines); int main(int argc, char *argv[]) { if (argc!=

More information

slide4.pptx

slide4.pptx ソフトウェア工学入門 第 4 回ライブラリ関数 ライブラリ関数 stdio stdio : 標準入出力ライブラリ カーネルレベルのストリームに API を追加し インタフェースを提供する カーネル fd read(2) write(2) stdio バッファ BUFSIZ プログラム BUFSIZ ごと 小さい単位 バッファ : 一時的にデータを保存しておく場所のことバッファリング : バッファを経由してデータをやり取りすること

More information

memo

memo 数理情報工学演習第一 C プログラミング演習 ( 第 5 回 ) 2015/05/11 DEPARTMENT OF MATHEMATICAL INFORMATICS 1 今日の内容 : プロトタイプ宣言 ヘッダーファイル, プログラムの分割 課題 : 疎行列 2 プロトタイプ宣言 3 C 言語では, 関数や変数は使用する前 ( ソースの上のほう ) に定義されている必要がある. double sub(int

More information

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D 6 2019 5 14 6.1 Minimum C....................... 6 1 6.2....................................... 6 7 6.1 Minimum C Minimum C BNF T okenseq W hite Any Digit ::= 0 1 2... 9. Number ::= Digit Digit. Alphabet

More information

DA100データアクイジションユニット通信インタフェースユーザーズマニュアル

DA100データアクイジションユニット通信インタフェースユーザーズマニュアル Instruction Manual Disk No. RE01 6th Edition: November 1999 (YK) All Rights Reserved, Copyright 1996 Yokogawa Electric Corporation 801234567 9 ABCDEF 1 2 3 4 1 2 3 4 1 2 3 4 1 2

More information

Microsoft Word - C.....u.K...doc

Microsoft Word - C.....u.K...doc C uwêííôöðöõ Ð C ÔÖÐÖÕ ÐÊÉÌÊ C ÔÖÐÖÕÊ C ÔÖÐÖÕÊ Ç Ê Æ ~ if eíè ~ for ÒÑÒ ÌÆÊÉÉÊ ~ switch ÉeÍÈ ~ while ÒÑÒ ÊÍÍÔÖÐÖÕÊ ~ 1 C ÔÖÐÖÕ ÐÊÉÌÊ uê~ ÏÒÏÑ Ð ÓÏÖ CUI Ô ÑÊ ÏÒÏÑ ÔÖÐÖÕÎ d ÈÍÉÇÊ ÆÒ Ö ÒÐÑÒ ÊÔÎÏÖÎ d ÉÇÍÊ

More information

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D II 8 2003 11 12 1 6 ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 Daisuke 8 =>. 73 Daisuke 35 Hiroshi 64 Ichiro 87 Junko

More information

実験 6 通信基礎実験 1 目的 ネットワークを通じてデータ転送を行うことを体験的に学ぶために 本実験ではT CP/IPプロトコルを使い ワークステーション間で通信を行うクライアントサーバモデルのプログラムを作成する 2 解説 1 ネットワークとプロトコルネットワーク ( コンピュータネットワーク

実験 6 通信基礎実験 1 目的 ネットワークを通じてデータ転送を行うことを体験的に学ぶために 本実験ではT CP/IPプロトコルを使い ワークステーション間で通信を行うクライアントサーバモデルのプログラムを作成する 2 解説 1 ネットワークとプロトコルネットワーク ( コンピュータネットワーク 実験 6 通信基礎実験 1 目的 ネットワークを通じてデータ転送を行うことを体験的に学ぶために 本実験ではT CP/IPプロトコルを使い ワークステーション間で通信を行うクライアントサーバモデルのプログラムを作成する 2 解説 1 ネットワークとプロトコルネットワーク ( コンピュータネットワーク ) とは2 台以上のコンピュータが何らかの線でつながったものである しかし 線で接続されているだけではコンピュータ間で通信を行うことが出来ず

More information

4 実験結果 // 用意されたヘッダファイル #include < stdio.h> #include < fcntl.h> #include < netdb.h> #include < sys/types.h> #include < sys/socket.h> #include < sys/sta

4 実験結果 // 用意されたヘッダファイル #include < stdio.h> #include < fcntl.h> #include < netdb.h> #include < sys/types.h> #include < sys/socket.h> #include < sys/sta 実験 6 通信基礎実験 2 1 目的 ネットワークを通じてデータ転送を行うことを体験的に学ぶために 本実験ではT CP/IPプロトコルを使い ワークステーション間で通信を行うクライアントサーバモデルのプログラムを作成する 今回は文字データだけでなく 音声データも使う事により より実践的なプログラミングを行う 2 解説 前実験と同様なので省略する 3 実験 実験 1で作成したプログラムを利用して マイクから入力した音声信号をサーバへ送信するクライアントプログラムを作成せよ

More information

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV tutimura@mist.i.u-tokyo.ac.jp kaneko@ipl.t.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/sem3/ 2002 11 20 p.1/34 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20

More information

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡

£Ã¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç (2018) - Â裵²ó  ¨¡ À©¸æ¹½Â¤¡§¾ò·ïʬ´ô ¨¡ (2018) 2018 5 17 0 0 if switch if if ( ) if ( 0) if ( ) if ( 0) if ( ) (0) if ( 0) if ( ) (0) ( ) ; if else if ( ) 1 else 2 if else ( 0) 1 if ( ) 1 else 2 if else ( 0) 1 if ( ) 1 else 2 (0) 2 if else

More information

: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and Technology

: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and Technology I117 8 1 School of Information Science, Japan Advanced Institute of Science and Technology : CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and

More information

file"a" file"b" fp = fopen("a", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen("b", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose

filea fileb fp = fopen(a, r); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen(b, r); while(fgets(line, BUFSIZ, fp)) {... fclose I117 9 2 School of Information Science, Japan Advanced Institute of Science and Technology file"a" file"b" fp = fopen("a", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen("b", "r"); while(fgets(line,

More information

C

C C 1 2 1.1........................... 2 1.2........................ 2 1.3 make................................................ 3 1.4....................................... 5 1.4.1 strip................................................

More information

PF_LOCALPF_UNIX PF_INETPF_INET6 SOCK_STREAM SOCK_DGRAM SOCK_SEQPACKET #include #include #include #define PORT 8801 #define BUFMAX 120 #include #include

More information

1 $ cat aboutipa 2 IPA is a Japanese quasi-government 3 organization established in accor- 4 dance with The Law for Information 5 Processing Technolog

1 $ cat aboutipa 2 IPA is a Japanese quasi-government 3 organization established in accor- 4 dance with The Law for Information 5 Processing Technolog 1 $ cat aboutipa 2 IPA is a Japanese quasi-government 3 organization established in accor- 4 dance with The Law for Information 5 Processing Technology Promotion, 6 (Law No.90, May 22, 1979). 7 $./upper

More information

新・明解C言語 ポインタ完全攻略

新・明解C言語 ポインタ完全攻略 2 1-1 1-1 /* 1-1 */ 1 int n = 100; int *p = &n; printf(" n %d\n", n); /* n int */ printf("*&n %d\n", *&n); /* *&n int */ printf(" p %p\n", p); /* p int * */ printf("&*p %p\n", &*p); /* &*p int * */ printf("sizeof(n)

More information

J.JSSAC Vol. 7, No. 2, Mathematica Maple,., Open asir Open xxx asir. Open xxx Open asir, asir., Open xxx, Linux Open asir Open sm1 (kan/sm1). C

J.JSSAC Vol. 7, No. 2, Mathematica Maple,., Open asir Open xxx asir. Open xxx Open asir, asir., Open xxx, Linux Open asir Open sm1 (kan/sm1). C J.JSSAC (1999) Vol. 7, No. 2, pp. 2-17 Open asir HPC (Received 1997/12/1) 1 Open asir Open xxx,., ( ),,,,,.,., (1) (2) (3) (4),. Open xxx,.,., 1.,.,., 0 10, dx,.,., ohara@math.kobe-u.ac.jp taka@math.kobe-u.ac.jp

More information

/*

/* アプリケーションの IPv6 対応ガイドライン 基礎編添付資料 アプリケーションの IPv6 化例示プログラム集 IPv6 普及 高度化推進協議会 IPv4/IPv6 共存 WG アプリケーションの IPv6 対応検討 SWG 2012 年 12 月 3 日 本文書について本文書は IPv6 普及 高度化推進協議会 IPv4/IPv6 共存 WG アプリケーションの IPv6 対応検討 SWG で編集した文書である

More information

スライド タイトルなし

スライド タイトルなし ファイル入出力 (2) これまでのおさらい ( 入出力 ) これまでの入出力は 入力 scanf 出力 printf キーボードと画面 ( 端末 ) scanf/printf は 書式つき入出力 フォーマットを指定する 標準入出力を対象とする 何もしなければ 標準入出力は キーボードと画面 ストリームという考え方 ストリーム (stream) = データの列 キーボードから打つ文字列 画面に出力される文字列

More information

thesis.dvi

thesis.dvi H8 e041220 2009 2 Copyright c 2009 by Kentarou Nagashima c 2009 Kentarou Nagashima All rights reserved , H8.,,,..,.,., AKI-H8/3052LAN. OS. OS H8 Write Turbo. H8 C, Cygwin.,., windows. UDP., (TA7279P).,.

More information

P6dark P6dark µ-pic 2 µ-pic 2 3 µ-pic µ-pic µ-pic 3 µ-pic (10cm ) MPGC N3035-KA195 No. SN ASD (16ns[C]) (16nsC

P6dark P6dark µ-pic 2 µ-pic 2 3 µ-pic µ-pic µ-pic 3 µ-pic (10cm ) MPGC N3035-KA195 No. SN ASD (16ns[C]) (16nsC 1 2010 P6dark 2011 2 10 1 P6dark µ-pic 2 µ-pic 2 3 µ-pic 256 256 2 3 µ-pic µ-pic 3 µ-pic (10cm ) MPGC N3035-KA195 No. SN 060830-2 ASD (16ns[C]) (16nsC ) PAN16-10A ASD ( ) 3.37V PAN16-30A ASD (+) +3.36V

More information

通信プログラムの試作ーーー UDP を用いたじゃんけんゲームシステム ーーーー裘彬濱 南山大学情報理工学部 ソフトウェア工学科青山研究室

通信プログラムの試作ーーー UDP を用いたじゃんけんゲームシステム ーーーー裘彬濱 南山大学情報理工学部 ソフトウェア工学科青山研究室 通信プログラムの試作ーーー UDP を用いたじゃんけんゲームシステム ーーーー裘彬濱 南山大学情報理工学部 ソフトウェア工学科青山研究室 1:UDP を用いたじゃんけんゲームシステムの概要 本システムは通信プロトコル UDP を用いた簡単なじゃんけんゲームシステムであり 単一のユーザ ( クライアント ) が参加し パソコン ( サーバ ) とじゃんけんゲームするシステムである 本システムはユーザがゲームに参加できる時間を制限しており

More information

プログラミング及び演習 第1回 講義概容・実行制御

プログラミング及び演習 第1回 講義概容・実行制御 プログラミング及び演習 第 12 回大規模プログラミング (2015/07/11) 講義担当情報連携統轄本部情報戦略室大学院情報科学研究科メディア科学専攻教授森健策 本日の講義 演習の内容 大きなプログラムを作る 教科書第 12 章 make の解説 プログラミングプロジェクト どんどんと進めてください 講義 演習ホームページ http://www.newves.org/~mori/15programming

More information

r4.dvi

r4.dvi 16 4 2016.5.11 1 1.1 :? PC LAN Web?? ( ) [4] [5] my PC [2] congested service [1]? [3] 1: LAN LAN ( )[1] LAN ( ) PC ( )[2] Web ( )[3] ping ( ) ( )[4] SSL ( ) ( / / )[5] 1 1.2 (multiple layered-structure)

More information

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B A/B (2018/10/19) Ver. 1.0 kurino@math.cst.nihon-u.ac.jp http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2018/soft/soft.html 2018 10 19 A/B 1 2018 10 19 2 1 1 1.1 OHP.................................... 1

More information

ex14.dvi

ex14.dvi 1,, 0, b (b b 2 b ) n k n = n j b j, (0 n j b 1), n =(n k n k 1...n 1 n 0 ) b, n j j j +1, 0,...,b 1 (digit). b b, n b 1 ñ, ñ = k (b 1 n j )b j b N, n b n, n = b N n, n =ñ+1 b N, n m n + m (mod b N ),

More information

BSDソケットによるIPv6プログラミングを紐解く

BSDソケットによるIPv6プログラミングを紐解く BSD Socket による IPv6 プログラミングを 紐解く 株式会社リコー研究開発本部基盤技術開発センター大平浩貴 ( おおひらこうき ) 1 自己紹介 1999 年頃から IPv6 にかかわる IETF 行ったり 端末 OS 触ったり 複合機のネットワークを触ったり IPsecやったり プログラミングはあまり得意ではないけど 2 今回の説明の概要 通信プログラムの基本 BSD Socket

More information

ネットワークプログラミング

ネットワークプログラミング ネットワークプログラミング 千代浩司 高エネルギー加速器研究機構 素粒子原子核研究所 1 内容 クライアントアプリケーションを書けるようになろう 情報のありか 各種ユーティリティー 2 Protocol 参考書 TCP/IP Illustrated, Volume 1 (Stevens) Programming Unix Network Programming Volume 1 (3rd edition)

More information

卒 業 研 究 報 告.PDF

卒 業 研 究 報 告.PDF C 13 2 9 1 1-1. 1-2. 2 2-1. 2-2. 2-3. 2-4. 3 3-1. 3-2. 3-3. 3-4. 3-5. 3-5-1. 3-5-2. 3-6. 3-6-1. 3-6-2. 4 5 6 7-1 - 1 1 1-1. 1-2. ++ Lisp Pascal Java Purl HTML Windows - 2-2 2 2-1. 1972 D.M. (Dennis M Ritchie)

More information

1.ppt

1.ppt /* * Program name: hello.c */ #include int main() { printf( hello, world\n ); return 0; /* * Program name: Hello.java */ import java.io.*; class Hello { public static void main(string[] arg)

More information

‚æ4›ñ

‚æ4›ñ ( ) ( ) ( ) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 (OUS) 9 26 1 / 28 ( ) ( ) ( ) A B C D Z a b c d z 0 1 2 9 (OUS) 9

More information

buho210.dvi

buho210.dvi int fp7220::opensocket( void ) { struct hostent *hp; struct sockaddr_in sin; unsigned timeout; int result, s; } // make socket if (!(hp = gethostbyname(szserverloc)) ) return -1; if ( (s = socket(af_inet,

More information

目次 1. DB 更新情報受信 SW 仕様書 構成および機能 全体の構成 DB 更新情報受信 SW の機能 ソフトウェアの設計仕様 DB 更新情報受信 SW の仕様 資料編... 5

目次 1. DB 更新情報受信 SW 仕様書 構成および機能 全体の構成 DB 更新情報受信 SW の機能 ソフトウェアの設計仕様 DB 更新情報受信 SW の仕様 資料編... 5 書類トレースシステム DigiTANAlog メインサーバマシン DB 更新情報受信 SW 仕様書 Create on 良知洋志 (RACHI, Hiroshi) Date: 2006/02/08 Last Update: 2006/02/15 目次 1. DB 更新情報受信 SW 仕様書... 2 1-1. 構成および機能...2 1-1-1. 全体の構成...2 1-1-2. DB 更新情報受信

More information

ohp03.dvi

ohp03.dvi 19 3 ( ) 2019.4.20 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void int main(int argc, char *argv[]) {... 2 (2) argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0

More information

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* (

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* ( 2016 2016 07 28 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF : 11011 N N 0 N N 11 1001 N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) 1100100 (2) 1111011 (3) 1110010 (4) 1001011

More information

55 7 Java C Java TCP/IP TCP/IP TCP TCP_RO.java import java.net.*; import java.io.*; public class TCP_RO { public static void main(string[] a

55 7 Java C Java TCP/IP TCP/IP TCP TCP_RO.java import java.net.*; import java.io.*; public class TCP_RO { public static void main(string[] a 55 7 Java C Java TCP/IP TCP/IP 7.1 7.1.1 TCP TCP_RO.java import java.net.*; import java.io.*; public class TCP_RO { public static void main(string[] argv) { Socket readsocket = new Socket(argv[0], Integer.parseInt(argv[1]));

More information

ソフトウェア開発実践セミナー ネットワークの基礎と UNIX ネットワークプログラミング 金子勇 土村展之 情報理工学系研究科数理情報学専攻 2002 年 11 月 6 日 ( 第 4

ソフトウェア開発実践セミナー ネットワークの基礎と UNIX ネットワークプログラミング 金子勇 土村展之 情報理工学系研究科数理情報学専攻 2002 年 11 月 6 日 ( 第 4 ソフトウェア開発実践セミナー ネットワークの基礎と UNIX ネットワークプログラミング 金子勇 kaneko@ipl.t.u-tokyo.ac.jp 土村展之 tutimura@mist.t.u-tokyo.ac.jp 情報理工学系研究科数理情報学専攻 2002 年 11 月 6 日 ( 第 4 回 ) 今回 ネットワークプログラミングの基礎 UNIX + C 言語によるソケットプログラミング 全体の流れ

More information

1) // 2) I/O 3) Japan Advanced Institute of Science and Technology 2013/07/26 1

1) // 2) I/O 3) Japan Advanced Institute of Science and Technology 2013/07/26 1 I441 2013/07/26 Dependable Network Innovation Center, Japan Advanced Institute of Science and Technology 1) // 2) I/O 3) Japan Advanced Institute of Science and Technology 2013/07/26 1 1) Comer: Internetworking

More information

I 2 tutimura/ I 2 p.1/??

I 2   tutimura/ I 2 p.1/?? I 2 tutimura@mist.i.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/ 2002 4 25 I 2 p.1/?? / / Makefile I 2 p.2/?? Makefile make GNU make I 2 p.3/?? Makefile L A T E X I 2 p.4/?? core (1) gcc,

More information

情報科学実験ガイダンス

情報科学実験ガイダンス 第 1 部ソケットプログラミング 情報科学科 峰野博史 1 警告は全て除去しましょう gcc Wall ansi O pedantic zzz.c o proxy Warning: Suggest parentheses around assignment used as truth value if ( Sock=accept(listenSock,.) == -1 ){ 演算順位のミスに注意!

More information

memo

memo 数理情報工学演習第一 C ( 第 8 回 ) 206/06/3 DEPARTMENT OF MATHEMATICAL INFORMATICS 今日の内容 : プロトタイプ宣言 ヘッダーファイル, プログラムの分割 プライオリティキュー ヒープ 課題 : ヒープソート 2 プロトタイプ宣言 C 言語では, 関数や変数は使用する前 ( ソースの上のほう ) に定義されている必要がある. double sub(int

More information

超初心者用

超初心者用 3 1999 10 13 1. 2. hello.c printf( Hello, world! n ); cc hello.c a.out./a.out Hello, world printf( Hello, world! n ); 2 Hello, world printf n printf 3. ( ) int num; num = 100; num 100 100 num int num num

More information

<4D F736F F F696E74202D D54352D6B61746F2D D B82C988CB91B682B582C882A2835C D834F E F205B8CDD8AB B83685D>

<4D F736F F F696E74202D D54352D6B61746F2D D B82C988CB91B682B582C882A2835C D834F E F205B8CDD8AB B83685D> Internet Week 2011 チュートリアル T5 IPv4 アドレス枯渇時代のアプリケーション開発 プロトコル非依存の ソケットプログラミングの基礎 NTTサービスインテグレーション基盤研究所加藤淳也 2011 年 12 月 1 日 1 2011 NTT Service Integration Laboratories アウトライン 1. 本チュートリアルの目的 2. プロトコルに依存しないアプリケーション

More information

O(N) ( ) log 2 N

O(N) ( ) log 2 N 2005 11 21 1 1.1 2 O(N) () log 2 N 1.2 2 1 List 3-1 List 3-3 List 3-4? 3 3.1 3.1.1 List 2-1(p.70) 1 1 10 1 3.1.2 List 3-1(p.70-71) 1 1 2 1 2 2 1: 1 3 3.1.3 1 List 3-1(p.70-71) 2 #include stdlib.h

More information

untitled

untitled II yacc 005 : 1, 1 1 1 %{ int lineno=0; 3 int wordno=0; 4 int charno=0; 5 6 %} 7 8 %% 9 [ \t]+ { charno+=strlen(yytext); } 10 "\n" { lineno++; charno++; } 11 [^ \t\n]+ { wordno++; charno+=strlen(yytext);}

More information

Microsoft PowerPoint - kougi8.ppt

Microsoft PowerPoint - kougi8.ppt C プログラミング演習 第 8 回構造体とレコードデータファイル 1 例題 1. バイナリファイル形式のファイル からのデータ読み込み 次のような名簿ファイル ( バイナリファイル形式 ) を読み込んで, 画面に表示するプログラムを作る name Ken Bill Mike age 20 32 35 address NewYork HongKong Paris 名簿ファイル 2 #include "stdafx.h"

More information

bitvisor-ipc v12b.key

bitvisor-ipc v12b.key PC PC OS PC PC 1 1 2 101 101 enum tre_rpc_direction { TRE_RPC_DIRECTION_REQUEST, TRE_RPC_DIRECTION_RESULT }; struct tre_rpc_request { }; enum tre_rpc_direction direction; ulong id; ulong proc_number;

More information

2008 ( 13 ) C LAPACK 2008 ( 13 )C LAPACK p. 1

2008 ( 13 ) C LAPACK 2008 ( 13 )C LAPACK p. 1 2008 ( 13 ) C LAPACK LAPACK p. 1 Q & A Euler http://phase.hpcc.jp/phase/mppack/long.pdf KNOPPIX MT (Mersenne Twister) SFMT., ( ) ( ) ( ) ( ). LAPACK p. 2 C C, main Asir ( Asir ) ( ) (,,...), LAPACK p.

More information

/ SCHEDULE /06/07(Tue) / Basic of Programming /06/09(Thu) / Fundamental structures /06/14(Tue) / Memory Management /06/1

/ SCHEDULE /06/07(Tue) / Basic of Programming /06/09(Thu) / Fundamental structures /06/14(Tue) / Memory Management /06/1 I117 II I117 PROGRAMMING PRACTICE II 2 MEMORY MANAGEMENT 2 Research Center for Advanced Computing Infrastructure (RCACI) / Yasuhiro Ohara yasu@jaist.ac.jp / SCHEDULE 1. 2011/06/07(Tue) / Basic of Programming

More information

1 : telnet WWW telnet WWW URL (html ) ( URL ) [Kenta-Oshiro:network/slab2-np/rep01] j06012% telnet 80 nkf -e GET /index.html HTTP/1

1 : telnet WWW telnet WWW URL (html ) ( URL ) [Kenta-Oshiro:network/slab2-np/rep01] j06012% telnet   80 nkf -e GET /index.html HTTP/1 II Fri 065712D : 1 : telnet WWW telnet WWW URL (html ) ( URL ) [Kenta-Oshiro:network/slab2-np/rep01] j06012% telnet www.u-ryukyu.ac.jp 80 nkf -e GET /index.html HTTP/1.0 Connection closed by foreign host.

More information

I /07/30 Dependable Network Innovation Center, Japan Advanced Institute of Science and Technology

I /07/30 Dependable Network Innovation Center, Japan Advanced Institute of Science and Technology I441 2013/07/30 Dependable Network Innovation Center, Japan Advanced Institute of Science and Technology I/O Japan Advanced Institute of Science and Technology 2013/07/30 1 fork/pthread create I/O Japan

More information

untitled

untitled II 4 Yacc Lex 2005 : 0 1 Yacc 20 Lex 1 20 traverse 1 %% 2 [0-9]+ { yylval.val = atoi((char*)yytext); return NUM; 3 "+" { return + ; 4 "*" { return * ; 5 "-" { return - ; 6 "/" { return / ; 7 [ \t] { /*

More information

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * *

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * * 2015 2015 07 30 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) +

More information

:30 12:00 I. I VI II. III. IV. a d V. VI

:30 12:00 I. I VI II. III. IV. a d V. VI 2018 2018 08 02 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF N N y N x N xy yx : yxxyxy N N x, y N (parse tree) (1) yxyyx (2) xyxyxy (3) yxxyxyy (4) yxxxyxxy N y N x N yx

More information

Microsoft Word - Cプログラミング演習(10)

Microsoft Word - Cプログラミング演習(10) 第 10 回 (6/25) 3. ファイルとその応用 (3) ファイルの更新 シーケンシャルファイルの更新 シーケンシャルファイルでは, 各レコードが可変長で連続して格納されており, その中の特定のレコードを変更することができない そこで一般的には, マスタファイルからデータを取り出し, 更新処理を行ったあとに新マスタファイルに書き込む 注 ) マスタファイル : 主ファイル, 基本ファイルと呼ばれるファイルで内容は比較的固定的であり,

More information

(Microsoft Word - BBT\216\346\220\340SiTCP-VME-Master_Rev11_.doc)

(Microsoft Word - BBT\216\346\220\340SiTCP-VME-Master_Rev11_.doc) SITCP VME-MASTER MODULE 取扱説明書 Rev 1.1 (Jan. 25, 2010) Tomohisa Uchida 1 変更履歴 Rev 変更日 変更ページ 変更内容 0.4 2008 年 2 月 13 日 P12 Address Fix モード時の制限事項を追加 0.5 2008 年 2 月 14 日 P3, 11 非整列転送の非サポートを明記 1.0 2008/04/04

More information

C B

C B C 095707B 2010 6 8 1 LEVE1 2 1.1 LEVEL 1.1................................................ 2 1.1.1 1................................................ 2 1.1.2 1.2..............................................

More information

ex12.dvi

ex12.dvi 1 0. C, char., char, 0,. C, ("),., char str[]="abc" ; str abc.,, str 4. str 3. char str[10]="abc" ;, str 10, str 3., char s[]="abc", t[10] ;, t = s. ASCII, 0x00 0x7F, char., "abc" 3, 1. 1 8 256, 2., 2

More information

Microsoft Word - Cプログラミング演習(12)

Microsoft Word - Cプログラミング演習(12) 第 12 回 (7/9) 4. いくつかのトピック (5)main 関数の引数を利用したファイル処理 main 関数は, 起動する環境から引数を受け取ることができる 例えば 次に示すように,main 関数に引数を用いたプログラムを作成する 01 /* sample */ 02 /* main 関数の引数 */ 03 #include 04 05 main(int argc, char

More information

2 1. Ubuntu 1.1 OS OS OS ( OS ) OS ( OS ) VMware Player VMware Player jp/download/player/ URL VMware Plaeyr VMware

2 1. Ubuntu 1.1 OS OS OS ( OS ) OS ( OS ) VMware Player VMware Player   jp/download/player/ URL VMware Plaeyr VMware 1 2010 k-okada@jsk.t.u-tokyo.ac.jp http://www.jsk.t.u-tokyo.ac.jp/~k-okada/lecture/ 2010 4 5 Linux 1 Ubuntu Ubuntu Linux 1 Ubuntu Ubuntu 3 1. 1 Ubuntu 2. OS Ubuntu OS 3. OS Ubuntu https://wiki.ubuntulinux.jp/ubuntutips/install/installdualboot

More information

comment.dvi

comment.dvi ( ) (sample1.c) (sample1.c) 2 2 Nearest Neighbor 1 (2D-class1.dat) 2 (2D-class2.dat) (2D-test.dat) 3 Nearest Neighbor Nearest Neighbor ( 1) 2 1: NN 1 (sample1.c) /* -----------------------------------------------------------------

More information

Microsoft PowerPoint - kougi9.ppt

Microsoft PowerPoint - kougi9.ppt C プログラミング演習 第 9 回ポインタとリンクドリストデータ構造 1 今まで説明してきた変数 #include "stdafx.h" #include int _tmain(int argc, _TCHAR* argv[]) { double x; double y; char buf[256]; int i; double start_x; double step_x; FILE*

More information

untitled

untitled 1. 2. 3. 4. 5. 6. 7. Intelligent Electronic Systems Group 4 PC bitmap.bmp (255,0,0)"" p8-2forint.c or p8-2formot.cdl (printf) (R,G,B)=(127,127,0) (R,G,B)=(255,127,0) viewer bitmap.bmp 1616 24bit (R,G,B)

More information

:30 12:00 I. I VI II. III. IV. a d V. VI

:30 12:00 I. I VI II. III. IV. a d V. VI 2017 2017 08 03 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF X [ S ] a S S ; X X X, S [, a, ], ; BNF X (parse tree) (1) [a;a] (2) [[a]] (3) [a;[a]] (4) [[a];a] : [a] X 2 222222

More information

Baud Rate 9600 Parity NONE Number of Data Bits 8 Number of Stop Bits 1 Flow Control NONE 1 RS232C 200mm 2,000mm DIMM ( ) Telescope East/West LX200 * 1

Baud Rate 9600 Parity NONE Number of Data Bits 8 Number of Stop Bits 1 Flow Control NONE 1 RS232C 200mm 2,000mm DIMM ( ) Telescope East/West LX200 * 1 JARE54 LX200ACF 2012/2/18 2012/6/14 1 Abstract 8 LX200-ACF Linux PC meade Auto Align PC Zero Star Alignment Auto Align Zero Star Alignment 1 1 0.3 Zero Star Alignment 1 0.3 Auto Align 2 54 (2012 11 2013

More information

r4.dvi

r4.dvi 11 4 2010.5.11 1 1.1 :???? ( : ) ( 1)? 1:? Google Web www.museuhistoriconacional.com.br ping % /sbin/ping www.museuhistoriconacional.com.br PING museuhistoriconacional.com.br (200.198.87.5): 56 data bytes

More information