看板 C_and_CPP 關於我們 聯絡資訊
開發平台:ubuntu 額外使用的函式庫:無 兩隻程式, socket server and socket client 程式需求: 1.可以同時使用兩個 client 連到 server上面。 2.client 輸入數字傳送給 Server 完成運算並回傳。 遇到的問題: single thread 的狀況之下 程式的運行是沒有問題的 改成 multi thread 之後 socket有正常create 起來 server 可以正常 write message 給 client 但是 client send 給 server 的訊息好像沒有接到 程式: Server:http://ideone.com/rTrAQO 遇到問題的部分在第55行 56行跟57行是debug用的,只要可以印出來我的問題就解決了... Client:http://ideone.com/nreAdd 麻煩各位大大幫小魯解惑了Q_Q ----- Sent from JPTT on my Sony E6653. -- ◢████◢███ ╭═╮ ◢████◤◢███◤ ║˙║ █████ ████ < ˙║ █ ▉█ ████ ║˙║ ◢▇▇████ ╰═╯ ████████ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 49.216.64.91 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1493362973.A.7D8.html
holik0123: 可以先把socket_desc印出來看嗎? 04/28 16:55
yvb: 41. 55. 有問題. 04/28 20:25
Qbsuran: 在socket用pthread要join或detech他 傳fd直接硬轉就好別 04/29 00:21
Qbsuran: 用malloc 04/29 00:21
Qbsuran: *detach, unix network programming和the linux program 04/29 00:26
Qbsuran: ming interface可以看看 04/29 00:26