kqueue 채팅소스예제 구할 수 없을까요?

김광석의 이미지

kqueue를 공부하려고 하는데요.

메뉴얼등을 봐서 대충은 알겠는데 실제로 구현된 쉬운 예제가 없더군요.

bsdproxy, echo서버 예제등은 봤지만 상호작용하는 부분이 없어서

어떻게 해야할 지 잘 모르겠습니다.

혹시 고수분들 중에서 kqueue를 이용한 채팅서버예제를 구현해보신분

계시면 좀 부탁합니다.

텔넷으로 접속해서 다른 사용자들에게 데이타를 보내고 어떤 키를 누르면

접속을 끊고... 이런 정도면 좋겠는데요...

버려진의 이미지

http://www.synczone.net/zboard/data/sq_resource/kqueue_echo.c

--------------------------------
관리자 멘트
링크가 너무 길어서 수정했습니다.

김광석의 이미지

http//www.monkeys.com/freeware/kqueue-echo.c

위 사이트에서 퍼온 자료가 맞을겁니다.

제가 처음 접한 관련소스거든요.

근데 그 소스는 완벽히 구현된 소스가 아닌거 같아요

게다가 제가 원하는건 서로 상호작용할때 어떻게 하면 될까하는 것인데

select로 구현할때보다 더 어려워 보입니다.

그거 보고 스스로 해보라는 뜻이라면 할말이 없지만서두.......

역시 새로운 것은 참 다가가기 힘들군요.

choissi의 이미지

채팅의 구현은 아니지만...

kqueue와 select를 포장한 이벤트 핸들러 라이브러리 입니다.
0.3이나 0.4 정도 버젼의 소스를 분석해보시면..
님이 원하는 것을 얻을수 있을듯..

최신 버전엔 kqueue 가 빠진듯 하더군요
그리고 시그널이랑, 타이머가 들어가서 분석하실려면 좀 구찮을껍니다.

http://www.monkey.org/~provos/libevent/

The libevent API provides a mechanism to execute a callback
function when a specific event occurs on a file descriptor or after a
timeout has been reached.

libevent is meant to replace the asynchronous event loop found in
event driven network servers. An application just needs to call
event_dispatch() and can then add or remove events dynamically
without having to change the event loop.

Currently, libevent supports kqueue(2) and select(2). Support for
poll(2) and /dev/poll is planned. The internal event mechanism is
completely independent of the exposed event API, and a simple
update of libevent can provide this new functionality without
having to redesign the server applications.

More information about event notification mechanisms for network
servers can be found on Dan Kegel's "The C10K problem" web
page. Another library that abstracts asynchronous event
notification is liboop.

liboop는 http://liboop.org/ 여기가면 얻을 수 있죠
다른 글 모음 http://www.ezdoum.com/search.php?query=kqueue

울랄라~ 호기심 천국~!!
http://www.ezdoum.com

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.