業精於勤,荒於嬉;行成於思,毀於隨
安裝Docker 這邊 請自行參考一下 前輩現成的 軌跡 前輩寫得非常的好 請自學一下
docker 只有 command line 介面,想要顯示圖形,請為他安裝X11的 GUI介面
為你的Docker 安裝X11的 GUI介面 你可以參考前輩的 軌跡 Step 3會教你 最簡單的是離線 裝個 VcXsrv Windows X Server
用Docker 裝一下你的 NS2 2.35 版 環境 有ekiourk前輩幫忙都弄得妥妥貼貼的了 感恩有前輩吧 (這會建個Docker 的 NS2 Container)
下載 NSG2 你可以參考前輩的 軌跡 用此工具做你的腳本 XXXX.TCL
記得先啟動好你的 XSERVER 再用 docker cp 的指令 放進你的NS2 Container 中
然後 NS XXXX.TCL 你就可以跑了
docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=192.168.0.103:0.0 ekiourk/ns2 bash
(指令對應 自己的IP 還有 PORT, PORT 弄錯,你的人生是黑白的,阿不是,是你的畫面是黑白的!)
https://people.csail.mit.edu/hubert/pyaudio/
https://github.com/docker-library/docs/blob/master/mariadb/README.md
receiver
------------------------------------------------------------------------------------
#include <fcntl.h> /* For O_* constants */
#include <sys/stat.h> /* For mode constants */
#include <mqueue.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
int main (){
/* Code Listing 3.8:
Opening a POSIX message queue and retrieving a message
*/
/* Open the message queue for reading */
mqd_t mqd = mq_open ("/OpenCSF_MQ", O_RDONLY);
assert (mqd != -1);
/* Get the message queue attributes */
struct mq_attr attr;
assert (mq_getattr (mqd, &attr) != -1);
char *buffer = calloc (attr.mq_msgsize, 1);
assert (buffer != NULL);
/* Retrieve message from the queue and get its priority level */
unsigned int priority = 0;
if ((mq_receive (mqd, buffer, attr.mq_msgsize, &priority)) == -1)
printf ("Failed to receive message\n");
else
printf ("Received [priority %u]: '%s'\n", priority, buffer);
/* Clean up the allocated memory and message queue */
free (buffer);
buffer = NULL;
mq_close (mqd);
return 0;
}
==================================================
sender
------------------------------------------------------------------------------------
#include <fcntl.h> /* For O_* constants */
#include <sys/stat.h> /* For mode constants */
#include <mqueue.h>
#include <stdio.h>
#include <stdlib.h>
/* Code Listing 3.7:
Sending "HELLO" through a POSIX message queue
*/
/* Create and open a message queue for writing */
int main (){
mqd_t mqd = mq_open ("/OpenCSF_MQ", O_CREAT | O_EXCL | O_WRONLY, 0600, NULL);
/* Ensure the creation was successful */
if (mqd == -1) {
perror ("mq_open");
exit (1);
}
/* Send "HELLO" as a message with priority 10, then close the queue.
Note the size is 6 to include the null byte '\0'. */
mq_send (mqd, "HELLO", 6, 10);
mq_close (mqd);
return 0;
}
https://gist.github.com/rcgary/3347663