Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
実録mruby組み込み体験
Search
Misaki Shioi(塩井美咲/しおい)
May 11, 2022
Programming
0
2k
実録mruby組み込み体験
Fukuoka.rb 0x100 回 LT 大会 (#256)
Misaki Shioi(塩井美咲/しおい)
May 11, 2022
Tweet
Share
More Decks by Misaki Shioi(塩井美咲/しおい)
See All by Misaki Shioi(塩井美咲/しおい)
XPE2-bookclub Explained
coe401_
0
60
Some more adventure of Happy Eyeballs
coe401_
2
210
Introduction of Happy Eyeballs Version 2 (RFC8305) to the Socket library
coe401_
1
300
An adventure of Happy Eyeballs
coe401_
3
9k
Implementing "++" operator, stepping into parse.y
coe401_
4
12k
たのしいRubyの構文解析ツアー
coe401_
6
3.6k
Ruby (MRI) の好きなところ 30
coe401_
1
810
Packet analysis with mruby on Wireshark - dRuby as example
coe401_
3
3.2k
Toycol: Define your own application protocol
coe401_
2
2k
Other Decks in Programming
See All in Programming
NANIMACHI
naokiito
0
940
RemixとCloudflare Stack におけるFile Upload
ossamoon
1
130
pytest プラグインを開発して DRY に自動テストを書こう
inuatsu
2
260
WEBアプリケーションにおけるAWS Lambdaを用いた大規模な非同期処理の実践
delhi09
PRO
7
4k
(Deep|Web) Link support with expo-router
mrtry
0
170
DevFest Android in Korea 2024 - 안드로이드의 문단속 : 앱을 지키는 암호화 이야기
mdb1217
1
150
AWS CDKを用いたセキュアなCI/CDパイプラインの構築 / Build a secure CI/CD pipeline using AWS CDK
seike460
PRO
3
600
データサイエンスのフルサイクル開発を実現する機械学習パイプライン
xcnkx
2
500
Beyond Laravel Octane - Hyperf for Laravel Artisans
albertcht
1
130
UnJSで簡単に始めるCLIツール開発 / cli-tool-development-with-unjs
aoseyuu
2
260
"Swarming" をコンセプトに掲げるアジャイルチームのベストプラクティス
boykush
2
240
4年間変わらなかった YOUTRUSTのアーキテクチャ
daiki1003
1
530
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
362
19k
What the flash - Photography Introduction
edds
67
11k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
7
570
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Gamification - CAS2011
davidbonilla
80
5k
Art, The Web, and Tiny UX
lynnandtonic
296
20k
How to train your dragon (web standard)
notwaldorf
87
5.6k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
663
120k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
GraphQLとの向き合い方2022年版
quramy
43
13k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Transcript
ԘҪඒ࡙ TIJPJNN!DPF@ 'VLVPLBSCYճ-5େձ ࣮ NSVCZΈࠐΈମݧ
aaॕ'VLVPLBSC։࠵
ࣗݾհ ԘҪඒ࡙ ͓͍͠ (JU)VC!TIJPJNN 5XJUUFS!DPF@ 'VLVPLBSCͱ"TBLVTBSCʹ͍ΔNSVCZॳֶऀ ࠷ۙͷग़དྷࣄɿࡢѪ༻ͷ؟ڸΛഁյ͠·ͨ͠
NSVCZͱ Ҿ༻IUUQTHJUIVCDPNNSVCZNSVCZXIBUJTNSVCZ NSVCZJTUIFMJHIUXFJHIUJNQMFNFOUBUJPOPGUIF3VCZMBOHVBHF DPNQMZJOHUP QBSUPG UIF*40TUBOEBSE*UTTZOUBYJT3VCZY DPNQBUJCMF NSVCZDBOCFMJOLFEBOEFNCFEEFEXJUIJOZPVSBQQMJDBUJPO8F QSPWJEFUIFJOUFSQSFUFSQSPHSBNNSVCZ BOEUIFJOUFSBDUJWFNSVCZ
TIFMMNJSCBTFYBNQMFT:PVDBOBMTPDPNQJMF3VCZQSPHSBNTJOUP DPNQJMFECZUFDPEFVTJOHUIFNSVCZDPNQJMFSlNSCDz
NSVCZͱ Ҿ༻IUUQTHJUIVCDPNNSVCZNSVCZXIBUJTNSVCZ NSVCZJTUIFMJHIUXFJHIUJNQMFNFOUBUJPOPGUIF3VCZMBOHVBHF DPNQMZJOHUP QBSUPG UIF*40TUBOEBSE*UTTZOUBYJT3VCZY DPNQBUJCMF NSVCZDBOCFMJOLFEBOEFNCFEEFEXJUIJOZPVSBQQMJDBUJPO8F QSPWJEFUIFJOUFSQSFUFSQSPHSBNNSVCZ BOEUIFJOUFSBDUJWFNSVCZ
TIFMMNJSCBTFYBNQMFT:PVDBOBMTPDPNQJMF3VCZQSPHSBNTJOUP DPNQJMFECZUFDPEFVTJOHUIFNSVCZDPNQJMFSlNSCDz ʮNSVCZΞϓϦέʔγϣϯʹϦϯΫͯ͠ΈࠐΉ͜ͱ͕Ͱ͖Δʯ [
3VCZͰॻ͔Εͨιʔείʔυͱ $Ͱॻ͔ΕͨΞϓϦέʔγϣϯ͕͋Δͱ͖ɺ ΞϓϦέʔγϣϯ $ 3VCZ ʮNSVCZΛΞϓϦέʔγϣϯʹΈࠐΉʯΠϝʔδ
3VCZͰॻ͔ΕͨॲཧΛΞϓϦέʔγϣϯίʔυʹຒΊࠐΈɺ ΞϓϦέʔγϣϯ $ 3VCZ ʮNSVCZΛΞϓϦέʔγϣϯʹΈࠐΉʯΠϝʔδ 3VCZ
ຒΊࠐΜͩॲཧ͝ͱΞϓϦέʔγϣϯΛ࣮ߦ͢Δ ΞϓϦέʔγϣϯ $ 3VCZ ʮNSVCZΛΞϓϦέʔγϣϯʹΈࠐΉʯΠϝʔδ 3VCZ
NSVCZΛ$ΞϓϦέʔγϣϯʹΈࠐΉํ๏͍Ζ͍Ζ &YFDVUJOH3VCZDPEFXJUINSVCZ IUUQTNSVCZPSHEPDTBSUJDMFTFYFDVUJOHSVCZDPEFXJUINSVCZIUNM
NSVCZΛ$ΞϓϦέʔγϣϯʹΈࠐΉํ๏͍Ζ͍Ζ ΞϓϦέʔγϣϯίʔυͰNSVCZͷ$"1*Λհͯ͠ 3VCZͷιʔείʔυΛ࣮ߦ͢Δํ๏ 3VCZ ΞϓϦέʔγϣϯ $
NSVCZΛ$ΞϓϦέʔγϣϯʹΈࠐΉํ๏͍Ζ͍Ζ ιʔείʔυ 3VCZ Λݩʹ$ͷؔΛ࡞͠ɺ ΞϓϦέʔγϣϯίʔυ͔ΒJODMVEFͯ͠ݺͼग़͢ํ๏ 3VCZ ΞϓϦέʔγϣϯ $ $
$
NSVCZΛ$ΞϓϦέʔγϣϯʹΈࠐΉํ๏͍Ζ͍Ζ ιʔείʔυ 3VCZ ͔ΒόΠτίʔυ͕هड़͞ΕͨϑΝΠϧΛ࡞ ΞϓϦέʔγϣϯίʔυ͔ΒಡΈࠐΉํ๏ ͳͲͳͲʜ 3VCZ ΞϓϦέʔγϣϯ $
όΠτίʔυ NSCD NSCD
ͬͯΈ·͠ΐ͏
ࠓճΔ͜ͱ ͋Δͱ͜Ζʹ$Ͱॻ͔Εͨ5$1Τίʔαʔόʔ͕ ΫϥΠΞϯτ αʔόʔ )FMMP )FMMP
ࠓճΔ͜ͱ αʔόʔ 5$1Τίʔαʔόʔ $ ͷ࣮ int main(void) { // αʔόʔΞυϨεใͷऔಘɹ
// ιέοτͷ࡞ // ϦΫΤετͷͪड͚ // ϦΫΤετͷड͚͚ // ϦΫΤετͷಡΈࠐΈ // Ϩεϙϯεͷૹ৴ // ιέοτͷഁغ return 0; }
ࠓճΔ͜ͱ int main(void) { // αʔόʔΞυϨεใͷऔಘɹ // ιέοτͷ࡞ // ϦΫΤετͷͪड͚
// ϦΫΤετͷड͚͚ // ϦΫΤετͷಡΈࠐΈ // Ϩεϙϯεͷૹ৴ // ιέοτͷഁغ return 0; } ⬅︎ ͜Ε͕ۤखͳͷͰ ɹ3VCZͰ αʔόʔ 5$1Τίʔαʔόʔ $ ͷ࣮
struct addrinfo server_addr_hints, *server_addr, *server_addr_tmp; int addrinfoerr; memset(&server_addr_hints, 0, sizeof(struct
addrinfo)); server_addr_hints.ai_family = AF_INET; server_addr_hints.ai_socktype = SOCK_STREAM; server_addr_hints.ai_ fl ags = AI_PASSIVE; if ((addrinfoerr = getaddrinfo(HOST, PORT, &server_addr_hints, &server_addr)) < 0) { gai_strerror(addrinfoerr); } <$ͷ߹>αʔόʔΞυϨεใऔಘ // ศ্ٓ"'@*/&5ʹ͍ͯ͠·͢
struct addrinfo server_addr_hints, *server_addr, *server_addr_tmp; int addrinfoerr; memset(&server_addr_hints, 0, sizeof(struct
addrinfo)); server_addr_hints.ai_family = AF_INET; server_addr_hints.ai_socktype = SOCK_STREAM; server_addr_hints.ai_ fl ags = AI_PASSIVE; if ((addrinfoerr = getaddrinfo(HOST, PORT, &server_addr_hints, &server_addr)) < 0) { gai_strerror(addrinfoerr); } <$ͷ߹>αʔόʔΞυϨεใऔಘ // ศ্ٓ"'@*/&5ʹ͍ͯ͠·͢ ᶃΞυϨεใͷώϯτΛ֨ೲ͢Δߏମͱ ɹΞυϨεใΛ֨ೲ͢ΔߏମͷͨΊͷϝϞϦྖҬΛ֬อ ᶄΞυϨεใͷώϯτΛ֨ೲ͢ΔߏମʹΞυϨεใͷώϯτΛ֨ೲ ᶅΞυϨεใͷώϯτΛ֨ೲͨ͠ߏମΛར༻ͯ͠ ɹ࠷ॳʹݟ͔ͭͬͨΞυϨεใΛΞυϨεใΛ֨ೲ͢Δߏମʹ֨ೲ ɹ˞͜ͷͱ͖ɺΞυϨεใϦϯΫϦετʹͳ͓ͬͯΓɺ ɹɹΞυϨεใΛ֨ೲ͢Δߏମଞʹར༻Ͱ͖ΔީิͱͳΔ ɹɹΞυϨεใͷϙΠϯλΛ͍࣋ͬͯΔ
int listener; for (server_addr_tmp = server_addr; server_addr_tmp; server_addr_tmp = server_addr_tmp->ai_next)
{ listener = socket(server_addr_tmp->ai_family, server_addr_tmp->ai_socktype, server_addr_tmp->ai_protocol); if (listener < 0) continue; if (bind(listener, server_addr_tmp->ai_addr, server_addr_tmp->ai_addrlen) < 0) { close(listener); continue; } break; } <$ͷ߹>αʔόʔΞυϨεใऔಘ
int listener; for (server_addr_tmp = server_addr; server_addr_tmp; server_addr_tmp = server_addr_tmp->ai_next)
{ listener = socket(server_addr_tmp->ai_family, server_addr_tmp->ai_socktype, server_addr_tmp->ai_protocol); if (listener < 0) continue; if (bind(listener, server_addr_tmp->ai_addr, server_addr_tmp->ai_addrlen) < 0) { close(listener); continue; } break; } <$ͷ߹>αʔόʔΞυϨεใऔಘ ᶆϦΫΤετΛͪड͚ΔιέοτͷͨΊͷϝϞϦྖҬΛ༻ҙ ᶇΞυϨεใΛ֨ೲ͢Δߏମ͕࣋ͭϦϯΫΛͨͲͬͯ ɹ͜ͷߏମͷҰ෦ͷใ͔ΒιέοτΛ࡞͠ɺ ɹߋʹ͜ͷߏମͷଞͷใ͔Β࣮ࡍʹΞυϨεͱόΠϯυͰ͖Δ͔ࢼΈΔ ᶈιέοτͷ࡞ͱΞυϨεͷόΠϯυʹޭͨ͠ΒιέοτΛฦ͢
int listener; for (server_addr_tmp = server_addr; server_addr_tmp; server_addr_tmp = server_addr_tmp->ai_next)
{ listener = socket(server_addr_tmp->ai_family, server_addr_tmp->ai_socktype, server_addr_tmp->ai_protocol); if (listener < 0) continue; if (bind(listener, server_addr_tmp->ai_addr, server_addr_tmp->ai_addrlen) < 0) { close(listener); continue; } break; } <$ͷ߹>αʔόʔΞυϨεใऔಘ ᶆϦΫΤετΛͪड͚ΔιέοτͷͨΊͷϝϞϦྖҬΛ༻ҙ ᶇΞυϨεใΛ֨ೲ͢Δߏମ͕࣋ͭϦϯΫΛͨͲͬͯ ɹ͜ͷߏମͷҰ෦ͷใ͔ΒιέοτΛ࡞͠ɺ ɹߋʹ͜ͷߏମͷଞͷใ͔Β࣮ࡍʹΞυϨεͱόΠϯυͰ͖Δ͔ࢼΈΔ ᶈιέοτͷ࡞ͱΞυϨεͷόΠϯυʹޭͨ͠ΒιέοτΛฦ͢ ➡︎ ͍͠ʜ ɹΞυϨεͷݕࡧͱιέοτͷ࡞Λಉ࣌ʹߦͬͯ ɹΞυϨεͷ༗ޮੑΛݕূ͢Δඞཁ͕͋Δ ޮ͕ѱ͍
Addrinfo.getaddrinfo('localhost', 12345, Socket::AF_INET, Socket::SOCK_STREAM, nil, Socket::AI_PASSIVE). fi rst <3VCZͷ߹>αʔόʔΞυϨεใऔಘ BEESJOGPSC
"EESJOGPΦϒδΣΫτΛͭ͘Δ͚ͩʂ "EESJOGPΦϒδΣΫτ͕༗ޮͳΞυϨεใΛ͍࣋ͬͯΔ
Addrinfo.getaddrinfo('localhost', 12345, Socket::AF_INET, Socket::SOCK_STREAM, nil, Socket::AI_PASSIVE). fi rst <3VCZͷ߹>αʔόʔΞυϨεใऔಘ BEESJOGPSC
͜ͷॲཧΛΤίʔαʔόʔͷ෦Ͱ࣮ߦ͠ɺ ιέοτΛ࡞͢Δ ฦΓͱͳΔ"EESJOGPΦϒδΣΫτ ͷΞυϨεใ Λར༻ͯ͠
3VCZιʔείʔυΛΤίʔαʔόʔʹΈࠐΉ ΤίʔαʔόʔʹJODMVEFͯؔ͠ͱ࣮ͯ͠ߦ͢Δ BEESJOGPSC "EESJOGPHFUBEESJOGP Τίʔαʔόʔ $ BEESJOGPD BEESJOGP
BEESJOGP લड़ͷ3VCZιʔείʔυΛݩʹ$ؔBEESJOGP Λ࡞͠ɺ
NSVCZ͕༻ҙ͍ͯ͠ΔNSCDίϚϯυΛར༻͢Δ͜ͱͰ $ؔBEESJOGP BEESJOGPD Λ؆୯ʹ࡞͢Δ͜ͱ͕Ͱ͖Δ ͜͏ͯ͠࡞ͨ͠BEESJOGP ؔΛΤίʔαʔόʔ͔Β࣮ߦ͢Δ ɹ $ mruby/bin/mrbc
-Baddrinfo addrinfo.rb 3VCZιʔείʔυ͔Β$ؔΛ࡞͢Δ ໊ؔͱιʔεϑΝΠϧΛͯ͠NSCDίϚϯυΛ࣮ߦ
#include <mruby.h> #include “addrinfo.c” mrb_state *mrb = mrb_open(); // ͜͜ͰΔ͜ͱ
// ɹɾBEESJOGP ؔΛݺͼग़͢ // ɹɾ"EESJOGPΦϒδΣΫτ͔ΒΞυϨεใΛऔಘ͢Δ // ɾɹऔಘͨ͠ΞυϨεใͰιέοτΛ࡞͢Δ mrb_close(mrb); FDIPTFSWFSD BEESJOGPDΛಡΈࠐΉͱɺ BEESJOGP ͕ؔར༻Ͱ͖ΔΑ͏ʹͳΔ 3VCZιʔείʔυΛΤίʔαʔόʔʹΈࠐΉ
mrb_value addr = mrb_load_irep(mrb, addrinfo); mrb_value domain = mrb_funcall(mrb, addr,
"afamily", 0); mrb_value socktype = mrb_funcall(mrb, addr, "socktype", 0); mrb_value protocol = mrb_funcall(mrb, addr, "protocol", 0); mrb_value port = mrb_funcall(mrb, addr, "ip_port", 0); mrb_value address = mrb_funcall(mrb, addr, "ip_address", 0); BEESJOGP ؔΛݺͼग़͢ FDIPTFSWFSD BEESJOGP ؔΛ࣮ߦ͢Δͱ"EESJOGPΦϒδΣΫτ͕ฦͬͯ͘Δ
mrb_value addr = mrb_load_irep(mrb, addrinfo); mrb_value domain = mrb_funcall(mrb, addr,
"afamily", 0); mrb_value socktype = mrb_funcall(mrb, addr, "socktype", 0); mrb_value protocol = mrb_funcall(mrb, addr, "protocol", 0); mrb_value port = mrb_funcall(mrb, addr, "ip_port", 0); mrb_value address = mrb_funcall(mrb, addr, "ip_address", 0); "EESJOGPΦϒδΣΫτ͔ΒΞυϨεใΛऔಘ͢Δ ͜ͷ"EESJOGPΦϒδΣΫτ͔Β ιέοτͷ࡞ʹඞཁͳ֤छΞυϨεใΦϒδΣΫτΛऔಘ͢Δ FDIPTFSWFSD υϝΠϯ໊ ιέοτλΠϓ ϓϩτίϧ ϙʔτ൪߸ *1ΞυϨε
mrb_value addr = mrb_load_irep(mrb, addrinfo); mrb_value domain = mrb_funcall(mrb, addr,
"afamily", 0); mrb_value socktype = mrb_funcall(mrb, addr, "socktype", 0); mrb_value protocol = mrb_funcall(mrb, addr, "protocol", 0); mrb_value port = mrb_funcall(mrb, addr, "ip_port", 0); mrb_value address = mrb_funcall(mrb, addr, "ip_address", 0); ֤ΞυϨεใΦϒδΣΫτ͜ͷޙɺ ιέοτΛ࡞͢Δ$ؔͷҾͱͯ͠༻͞ΕΔ ͦͷࡍ3VCZΦϒδΣΫτ͔Β$ͷJOUܕʹม͓ͯ͘͠ඞཁ͕͋Δ FDIPTFSWFSD "EESJOGPΦϒδΣΫτ͔ΒΞυϨεใΛऔಘ͢Δ υϝΠϯ໊ ιέοτλΠϓ ϓϩτίϧ ϙʔτ൪߸ *1ΞυϨε
mrb_value addr = mrb_load_irep(mrb, addrinfo); mrb_value domain = mrb_funcall(mrb, addr,
"afamily", 0); mrb_value socktype = mrb_funcall(mrb, addr, "socktype", 0); mrb_value protocol = mrb_funcall(mrb, addr, "protocol", 0); mrb_value port = mrb_funcall(mrb, addr, "ip_port", 0); mrb_value address = mrb_funcall(mrb, addr, "ip_address", 0); FDIPTFSWFSD "EESJOGPΦϒδΣΫτ͔ΒΞυϨεใΛऔಘ͢Δ υϝΠϯ໊ ιέοτλΠϓ ϓϩτίϧ ϙʔτ൪߸ ͜͜·Ͱ*OUFHFSΦϒδΣΫτ *OUFHFSΦϒδΣΫτNSVCZͷ$"1*Λར༻͢Δ͜ͱͰ $ͷJOUܕม͢Δ͜ͱ͕Ͱ͖Δ
"EESJOGPΦϒδΣΫτ͔ΒΞυϨεใΛऔಘ͢Δ mrb_value addr = mrb_load_irep(mrb, addrinfo); mrb_value domain = mrb_funcall(mrb,
addr, "afamily", 0); mrb_value socktype = mrb_funcall(mrb, addr, "socktype", 0); mrb_value protocol = mrb_funcall(mrb, addr, "protocol", 0); mrb_value port = mrb_funcall(mrb, addr, "ip_port", 0); mrb_value address = mrb_funcall(mrb, addr, "ip_address", 0); FDIPTFSWFSD 4USJOHΦϒδΣΫτ$ͷJOUܕมͰ͖ͳ͍ FHlz *1ΞυϨε4USJOHΦϒδΣΫτ ͋Β͔͡Ί4USJOHΦϒδΣΫτ͔Β*OUFHFSΦϒδΣΫτม͢Δඞཁ͋Γ
*1ΞυϨε จࣈྻ Λ*1ΞυϨε ʹม͢Δ class Addr2Int RE_IPV4ADDRLIKE = %r{
\A (\d+) \. (\d+) \. (\d+) \. (\d+) \z }x def self.convert(addr) m = RE_IPV4ADDRLIKE.match(addr) octets = m.captures octets.inject(0) { |i, s| (n = s.to_i) < 256 s.match(/\A0./) i << 8 | n } end end BEESJOUSC ࢀߟIUUQTHJUIVCDPNSVCZJQBEESCMPCDDCFBECDDGEMJCJQBEESSC- *1ΞυϨεͷจࣈྻΛʹม͢Δ "EES*OUDPOWFSUϝιουΛ༻ҙ *1"EESFTTϥΠϒϥϦͷUP@Jϝιουͷ࣮Λ͓आΓͯ͠ʜ
"EES*OUDPOWFSUϝιουΛ࣮ͨ͠ιʔεϑΝΠϧΛ Τίʔαʔόʔ͔ΒಡΈࠐΉ NSVCZͷ$"1*Λར༻ͯ͠"EES*OUDPOWFSUϝιουΛݺͼग़͢ Τίʔαʔόʔ $ BEESJOUSC "EES*OUDPOWFSU Τίʔαʔόʔ͔Β"EES*OUDPOWFSUϝιουΛݺͼग़͢ "EES*OUDPOWFSU
"EESJOGPΦϒδΣΫτ͔ΒΞυϨεใΛऔಘ͢Δ mrb_value addr = mrb_load_irep(mrb, addrinfo); // … mrb_value address
= mrb_funcall(mrb, addr, "ip_address", 0); FILE *addr2int_src = fopen("addr2int.rb", "r"); mrb_load_ fi le(mrb, addr2int_src); fclose(addr2int_src); mrb_value addr2int_klass = mrb_obj_value(mrb_class_get(mrb, "Addr2Int")); mrb_value inaddr = mrb_funcall(mrb, addr2int_klass, "convert", 1, address); FDIPTFSWFSD BEESJOUSCιʔεϑΝΠϧΛ ಡΈࠐΉ "EES*OUDPOWFSUϝιουʹ*1ΞυϨε จࣈྻ Λ࣮ͯ͠ߦ
"EESJOGPΦϒδΣΫτ͔ΒΞυϨεใΛऔಘ͢Δ mrb_value addr = mrb_load_irep(mrb, addrinfo); // … mrb_value address
= mrb_funcall(mrb, addr, "ip_address", 0); FILE *addr2int_src = fopen("addr2int.rb", "r"); mrb_load_ fi le(mrb, addr2int_src); fclose(addr2int_src); mrb_value addr2int_klass = mrb_obj_value(mrb_class_get(mrb, "Addr2Int")); mrb_value inaddr = mrb_funcall(mrb, addr2int_klass, "convert", 1, address); FDIPTFSWFSD ➡︎ *1ΞυϨεΛද͢*OUFHFSΦϒδΣΫτ͕ฦͬͯ͘Δ BEESJOUSCιʔεϑΝΠϧΛ ಡΈࠐΉ "EES*OUDPOWFSUϝιουʹ*1ΞυϨε จࣈྻ Λ࣮ͯ͠ߦ
struct sockaddr_in saddr; saddr.sin_family = mrb_integer(domain); saddr.sin_addr.s_addr = htonl(mrb_integer(inaddr)); saddr.sin_port
= htons(mrb_integer(port)); int listener; if ((listener = socket(mrb_integer(domain), mrb_integer(socktype), mrb_integer(protocol))) < 0) { perror("socket(2)"); exit(1); } // … औಘͨ͠ΞυϨεใͰιέοτΛ࡞͢Δ FDIPTFSWFSD ΞυϨεใͷ*OUFHFSΦϒδΣΫτΛ$ͷJOUܕʹม͠ɺ ιέοτΛ࡞ ҎԼɺͦͷଞͷॲཧΛ࣮ ม ιέοτ࡞ ม ม ม ม ม
αʔόʔ NSVCZͷMJCNSVCZBϑΝΠϧͱϦϯΫͯ͠ΤίʔαʔόʔΛίϯύΠϧ ΤίʔαʔόʔΛىಈ͢Δ
αʔόʔ ΫϥΠΞϯτ NSVCZͷMJCNSVCZBϑΝΠϧͱϦϯΫͯ͠ΤίʔαʔόʔΛίϯύΠϧ ΤίʔαʔόʔΛىಈ͢Δ ΫϥΠΞϯτ͔ΒαʔόʔϝοηʔδΛૹ৴͢Δ
αʔόʔ αʔόʔ ΫϥΠΞϯτ NSVCZͷMJCNSVCZBϑΝΠϧͱϦϯΫͯ͠ΤίʔαʔόʔΛίϯύΠϧ ΤίʔαʔόʔΛىಈ͢Δ ΫϥΠΞϯτ͔ΒαʔόʔϝοηʔδΛૹ৴͢Δ αʔόʔϝοηʔδΛड͚औΓɺͦͷ··ΫϥΠΞϯτฦ৴͢Δ
αʔόʔ αʔόʔ ΫϥΠΞϯτ NSVCZͷMJCNSVCZBϑΝΠϧͱϦϯΫͯ͠ΤίʔαʔόʔΛίϯύΠϧ ΤίʔαʔόʔΛىಈ͢Δ ΫϥΠΞϯτ͔ΒαʔόʔϝοηʔδΛૹ৴͢Δ αʔόʔϝοηʔδΛड͚औΓɺͦͷ··ΫϥΠΞϯτฦ৴͢Δ ΫϥΠΞϯταʔόʔ͔Βͷฦ৴Λड͚औΔ
ࢀߟਤॻ 8FCͰ͑Δ NSVCZγεςϜϓϩάϥϛϯάೖ ஶऀɿۙ౻Ӊஐ࿕ IUUQTXXXDSDPNCPPLEFUBJM ೖNSVCZ $͔ΒNSVCZ"1*Λ͍͜ͳ͢ ஶऀ:BNBOFLLP IUUQTCPPUIQNKBJUFNT
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ ḉ
None
None
None
None