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
2.1k
実録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
71
Some more adventure of Happy Eyeballs
coe401_
2
240
Introduction of Happy Eyeballs Version 2 (RFC8305) to the Socket library
coe401_
1
330
An adventure of Happy Eyeballs
coe401_
3
9.4k
Implementing "++" operator, stepping into parse.y
coe401_
4
12k
たのしいRubyの構文解析ツアー
coe401_
6
3.7k
Ruby (MRI) の好きなところ 30
coe401_
1
840
Packet analysis with mruby on Wireshark - dRuby as example
coe401_
3
3.3k
Toycol: Define your own application protocol
coe401_
2
2.1k
Other Decks in Programming
See All in Programming
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
Realtime API 入門
riofujimon
0
150
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
Macとオーディオ再生 2024/11/02
yusukeito
0
370
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
C++でシェーダを書く
fadis
6
4.1k
Click-free releases & the making of a CLI app
oheyadam
2
110
Jakarta EE meets AI
ivargrimstad
0
510
RubyLSPのマルチバイト文字対応
notfounds
0
120
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
120
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Thoughts on Productivity
jonyablonski
67
4.3k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
The Pragmatic Product Professional
lauravandoore
31
6.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
What's new in Ruby 2.0
geeforr
343
31k
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