看板 C_and_CPP 關於我們 聯絡資訊
http://nopaste.csie.org/f7b8c 上面是我的程式碼 本程式利用fork產生一個receive udp封包 當udp封包接受之後,會去判斷改變route裡面的distance 然後parent process broadcast 問題:當receive之後會改變distance 然後send要傳出 但是傳出的distance並沒有改變 不曉得這樣用sharememory正不正確,因為這部份是從網路看來的 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.113.177.129
sunneo:htons反了吧 client用ntohs吧 12/27 00:21
sunneo:這不是share memory吧 只是一種IPC的途徑 12/27 00:24
hubert100:htons應該沒錯吧因為可以收送 我不知道什麼是ipc orz 12/27 00:49
hubert100:想要達到recv收到透過changeHop改得distance_ 12/27 00:50
hubert100:send丟出後也有改過 但是目前這份沒有辦法 12/27 00:51
sunneo:hton* host to network byte order 12/27 01:07
sunneo:ntoh* network to host byte order 12/27 01:07
hubert100:後來自己改成用struct寫 已經ok了! 01/03 00:22