我想使用docker inspect检索映射到容器的端口,我发现了类似的东西:
docker inspect --format=" {{ .NetworkSettings.Ports }} " containerid
Run Code Online (Sandbox Code Playgroud)
输出:
map[1234/tcp:[map[HostIp:0.0.0.0 HostPort:49159]] 3306/tcp:<nil> 4444/tcp:<nil> 4567/tcp:<nil> 4568/tcp:<nil>]
Run Code Online (Sandbox Code Playgroud)
但是我希望有这样的输出:
1234/tcp:49159
Run Code Online (Sandbox Code Playgroud)
可能吗 ?
我在std :: chrono中遇到了一个奇怪的错误,如果我这样做:
TimeHandling time(std::chrono::milliseconds(1000 / 125));
time.start();
Run Code Online (Sandbox Code Playgroud)
一切都好.但如果相反,我将毫秒值放在变量中:
int mpl = 1000 / 125;
TimeHandling time(std::chrono::milliseconds(mpl));
time.start();
Run Code Online (Sandbox Code Playgroud)
g ++抛出此错误:
request for member ‘start’ in ‘time’, which is of non-class type ‘TimeHandling(std::chrono::milliseconds) {aka TimeHandling(std::chrono::duration<long int, std::ratio<1l, 1000l> >)}’
Run Code Online (Sandbox Code Playgroud)
有人知道为什么吗?
当我从这样的SOCK_STREAM套接字读取时:
int t;
while ((t = read(clientsocket, buff, 128) > 0))
{
write(1, buff, t);
}
Run Code Online (Sandbox Code Playgroud)
read总是返回1,但如果我用gdb查看buff,我可以看到我发送的整行.我正在使用netcat将数据发送到服务器.