[네트워크/Unix] 소켓 통신 개념


Unix 소켓 통신의 개념을 함수 별로 정리해보려 합니다.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHb_x-RsWB5lmcKWmA95d5A96nN4H89CZTkYEf8dUkwlaHmtSz1nBVIJTWuGqpMJxM_x-h0d0WWAzPVxavdiqjz-34KxAwO7v35RPzn46qY3EV1-b_UVpKTmfqmGldr-frB9VVCt-9_Q/s1600/1.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" loading="lazy" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHb_x-RsWB5lmcKWmA95d5A96nN4H89CZTkYEf8dUkwlaHmtSz1nBVIJTWuGqpMJxM_x-h0d0WWAzPVxavdiqjz-34KxAwO7v35RPzn46qY3EV1-b_UVpKTmfqmGldr-frB9VVCt-9_Q/s1600-rw/1.JPG" /></a></div>
<br />

---
1. Application에서 Socket 함수 호출 시, Kernel을 통해 Socket 기술자가 생성됩니다.<br />

<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7fWstR918LpU0V1O-MCN0QzjdDPEbDzuxZz5FBP-OYIqSlswioM8YO12HwpZjIZaqP0QM2rB9TwP0bhG8LPIMnTtCkbCxOG5nJ_b5ad8uiyEFrifhFtKfJH5xMweePPiwG1rxmfos_g/s1600/2.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" loading="lazy" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7fWstR918LpU0V1O-MCN0QzjdDPEbDzuxZz5FBP-OYIqSlswioM8YO12HwpZjIZaqP0QM2rB9TwP0bhG8LPIMnTtCkbCxOG5nJ_b5ad8uiyEFrifhFtKfJH5xMweePPiwG1rxmfos_g/s1600-rw/2.JPG" /></a></div>
<br />

---
2. Bind, IP 혹은 Port정보를 통해, 소켓 기술자와 Application을 연결합니다.<br />

<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL-qcTzhBd2sNycGtE-oIjsjijhJ2X8WWKc8kWW-LEB2YSzEOVjb1S3mgxdxkWlPyQL-4m8X93Yhgmx1v9yglftC4rVlSQ3Yn0BSDwukJ-CBKQ0rDTQ1lRbRmfk_2_wrJcmD5QatBMBg/s1600/3.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" loading="lazy" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL-qcTzhBd2sNycGtE-oIjsjijhJ2X8WWKc8kWW-LEB2YSzEOVjb1S3mgxdxkWlPyQL-4m8X93Yhgmx1v9yglftC4rVlSQ3Yn0BSDwukJ-CBKQ0rDTQ1lRbRmfk_2_wrJcmD5QatBMBg/s1600-rw/3.JPG" /></a></div>
<br />

---
3. 이후 Listen을 호출하면 해당 소켓에 대한 Back log Queue, 연결 대기 큐가 생기게 됩니다.<br />

<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUtCzenI7XwsWpPCp0uLbB2X7KCvN7928gO3jlabTQnkHBjXaHjoY02W3fbkRUsrINLTWlsVmbt7j7bMrRlakZ8SlsoJOe7TMFc7iZjz0jfDwf7uQDwSiBIZQclt0ZvAuChvieW5wujw/s1600/4.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" loading="lazy" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUtCzenI7XwsWpPCp0uLbB2X7KCvN7928gO3jlabTQnkHBjXaHjoY02W3fbkRUsrINLTWlsVmbt7j7bMrRlakZ8SlsoJOe7TMFc7iZjz0jfDwf7uQDwSiBIZQclt0ZvAuChvieW5wujw/s1600-rw/4.JPG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
---
4. Client 연결 요청에 따라, Backlog Queue 에 쌓이게 됩니다.<br />

<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIUWVOM2m9AoView2iNm8hM3LoagsLaBKQ4J9RkOJOJeVfosqIBvDB498UngBhlMQyHetfxIzi2XnPoxHg3fPkKNhpZhuBldI0ROFFT9FcPWAcvFZNxBUI0c59YPhxrZMrLq8PsvYATQ/s1600/5.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" loading="lazy" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIUWVOM2m9AoView2iNm8hM3LoagsLaBKQ4J9RkOJOJeVfosqIBvDB498UngBhlMQyHetfxIzi2XnPoxHg3fPkKNhpZhuBldI0ROFFT9FcPWAcvFZNxBUI0c59YPhxrZMrLq8PsvYATQ/s1600-rw/5.JPG" /></a></div>

---
<br />
5. &nbsp;이후 Backlog Queue에 쌓인 Client를 FIFO 로 가져오게됩니다.<br />
<br />
<br />
<br />
여기까지가 unix 함수를 통해 알아본 소켓 내부 동작과정입니다.<br />
<br />
<br />
아마 거의 모든 소켓프로그래밍이 이 과정을 거치리라 생각합니다.<br />
<br />
<br />
<br />
<br />


추가로 읽으면 좋을 것

댓글

이 블로그의 인기 게시물

윤석열 계엄령 선포! 방산주 대폭발? 관련주 투자 전략 완벽 분석

대통령 퇴진운동 관련주: 방송·통신·촛불수혜주 완벽 분석

키움 OPEN API MFC 개발 (1)