■ Linux supports an abstract namespace for sockets, so not all of these are actually bound/connected to a file.
Instead, they connect to a “name” instead, which cannot be traced back to a file.
For those interested, looking at /proc/net/unix or netstat -xa shows the abstract ones starting with an @ sign.
되면 한다! / feel no sorrow, feel no pain, feel no hurt, there's nothing gained.. only love will then remain.. 『 Mizz 』
unix domain socket 을 쓸 때, 실제 파일 경로를 사용하지 않아도 된다는 뜻입니다.
이 경우에는, 그냥 파일이 아닌 그냥 이름(name) 으로 취급되는데.. (abstract domain socket)
/proc/net/unix 파일을 열어 보거나, netstat 명령으로 봤을 때, 파일명 앞에 @를 붙여서 구별해 준다는 뜻이죠.
쓰는 방법은 sockaddr_un 구조체의 sun_path 에서 첫번째 바이트를 '\0' 으로 넣어주고, 그 뒤에 파일의 경로를 적어 주면 됩니다.
$ netstat -anp | grep a.out
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
unix 2 [ ] DGRAM 189653 3374/a.out @/path/to/non-exist
unix(7) 의 man page 에서 Address Format 섹션의 abstract 부분을 보세요. (man -7 unix)
되면 한다! / feel no sorrow, feel no pain, feel no hurt, there's nothing gained.. only love will then remain.. 『 Mizz 』
음 ..
http://blog.siphos.be/2011/12/unix-domain-sockets-are-files/
되면 한다! / feel no sorrow, feel no pain, feel no hurt, there's nothing gained.. only love will then remain.. 『 Mizz 』
항상 답글 감사합니다. ymir님
독해를 잘 못하는 저로써는.. 그냥 보면 일단 추상적인 네임스페이스로 사용되는것 같은데....
파일은 존재하지 않고 그냥 @붙인 파일이름으로 사용하는 것인지...
정확하게 모르겠더라구요...
인터넷에 있는 일반적인 테스트용 소스로 @붙여서 실행하면 그냥 ㅍㅏ일이 생기는것이고..
어떻게 써야 되는건지...
음 ..
unix domain socket 을 쓸 때, 실제 파일 경로를 사용하지 않아도 된다는 뜻입니다.
이 경우에는, 그냥 파일이 아닌 그냥 이름(name) 으로 취급되는데.. (abstract domain socket)
/proc/net/unix 파일을 열어 보거나, netstat 명령으로 봤을 때, 파일명 앞에 @를 붙여서 구별해 준다는 뜻이죠.
쓰는 방법은 sockaddr_un 구조체의 sun_path 에서 첫번째 바이트를 '\0' 으로 넣어주고, 그 뒤에 파일의 경로를 적어 주면 됩니다.
그럼 다음과 같이 표시되죠.
unix(7) 의 man page 에서 Address Format 섹션의 abstract 부분을 보세요. (man -7 unix)
되면 한다! / feel no sorrow, feel no pain, feel no hurt, there's nothing gained.. only love will then remain.. 『 Mizz 』
우아...
정말 감사합니다!! ㅠㅠ 이렇게 명쾌한 해답을 ..
댓글 달기