소켓통신 서버에서 클라이언트 send가 안됩니다..

rlswhgdk의 이미지

우분투환경에서 vi편집기로 파이썬 사용해서 단일 서버 다중클라이언트 소스를 작성했는데 단일서버에 두 클라이언트가 접속하고 둘 다 서버에 데이터 값을 전송하는데 서버에서는 클라이언트들로 전송을 못합니다. 서버와 값을 되돌려받는 클라이언트에 멀티스레드 처리도 했는데 서버에서 아예 클라이언트로 문장하나도 send를 못합니다 뭐가 문제일까요? 답변해주시면 감사하겠습니다

라스코니의 이미지

tcpdump 같은 걸로 패킷이 나가는지 확인하셨나요?

rlswhgdk의 이미지

알고보니 클라이언트가 받아들이지 못하고 있더라구요 답변 감사합니다

shint의 이미지

//일단. 여기 예제로 소켓 통신 해보니. 됩니다.
구름 IDE - 웹 컴파일러
https://www.goorm.io/
http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=278&MAEULNO=20&no=32422&page=1

파이썬 소켓 연결 사용법 (여기 예제)
https://soooprmx.com/archives/8737
https://wayhome25.github.io/python/2017/04/24/socket-chat/
https://steelkiwi.com/blog/working-tcp-sockets/

python3 /workspace/python/server.py &
python3 /workspace/python/client.py

뒤에 & 는 백그라운드 프로세스 실행 명령어
ps 로 프로세스 상태 확인
kill 로 프로세스 PID 종료

//카메라 소켓 통신 예제도 있네요.
Python socket server to send camera image to client (II)
https://www.youtube.com/watch?v=-2vPmYHMJTQ
http://helloraspberrypi.blogspot.com/2015/05/python-socket-server-to-send-camera_12.html
http://helloraspberrypi.blogspot.com/2015/05/python-socket-server-to-send-camera.html
http://helloraspberrypi.blogspot.com/2015/05/python-rpi-camera-module-capturing-to.html

send() 대신 write() 를 사용합니다.

//파이썬 소켓 함수 설명
https://docs.python.org/2/library/socket.html
https://docs.python.org/2/howto/sockets.html#socket-howto

send() 함수의 리턴값도 확인해보세요.

//비동기 소켓 통신 예제
https://github.com/django/channels/issues/908

//raise RuntimeError 로 검색해보면. 몇몇 try catch 예외 처리 내용도 보이네요.
https://doughellmann.com/blog/2009/06/19/python-exception-handling-techniques/
https://stackoverflow.com/questions/2052390/manually-raising-throwing-an-exception-in-python
https://github.com/aio-libs/aiohttp/issues/2706
https://github.com/tweepy/tweepy/issues/570
https://stackoverflow.com/questions/19302530/python-generator-send-function-purpose
https://github.com/django/channels/issues/908

//나머지는 connect() 나. 우분투 서버 포트가 방화벽 등으로 열리지 않은 경우. 확인해볼 사항은 찾아봐야 할거 같네요.
ubuntu send port
https://askubuntu.com/questions/509629/sending-data-to-port-does-not-seem-to-be-working-on-ubuntu-linux
https://www.digitalocean.com/community/questions/how-to-enable-port-25-on-my-ubuntu-server
https://ubuntuforums.org/showthread.php?t=1874310

넷캣(Netcat) 간단한 사용방법
http://devanix.tistory.com/307

How to Create a Simple Chat with netcat in Linux
https://linoxide.com/tools/simple-chat-netcat-linux/

Tutorial how to use adapter usb serial cable Ubuntu 14 04
https://www.youtube.com/watch?v=DXgvaibDJzo

----------------------------------------------------------------------------
젊음'은 모든것을 가능하게 만든다.

매일 1억명이 사용하는 프로그램을 함께 만들어보고 싶습니다.
정규 근로 시간을 지키는. 야근 없는 회사와 거래합니다.

각 분야별. 좋은 책'이나 사이트' 블로그' 링크 소개 받습니다. shintx@naver.com

rlswhgdk의 이미지

답변해주셔서 감사합니다 도움이 많이 됐습니다.

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.