我猜这个问题就是这么说的.
我想在Windows上分叉.什么是最相似的操作,我该如何使用它.
Windows 7中是否有可用的完整POSIX实现(我在考虑Windows Services for UNIX)?
它是否适用于每个版本的操作系统(似乎没有)?
它如何在以前的MS Windows POSIX实现中添加/改进或中断?
在哪里可以找到有关Windows 7中有关POSIX合规性的特定Microsoft方法和实现的更多信息?
我一直在关注Beej Networking指南,在服务器部分,有一部分代码叫做函数fork().
if (!fork()) { // this is the child process
close(sockfd); // child doesn't need the listener
if (send(new_fd, "Hello, world!", 13, 0) == -1)
perror("send");
close(new_fd);
exit(0);
Run Code Online (Sandbox Code Playgroud)
我在Windows机器上,不能让那部分工作.我能做些什么来解决这个问题?我的代码如下.
/* Server */
#define _WIN32_WINNT 0x501
#include <iostream>
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdio.h>
#include <sys/types.h>
using namespace std;
const int winsockVersion = 2;
#define BACKLOG 10
#define PORT "3000"
int main(void){
WSADATA wsadata;
if (WSAStartup(MAKEWORD(winsockVersion,0),&wsadata) == 0){
cout<<"-WSAStartup initialized..." << endl;
int status;
int sockfd, …Run Code Online (Sandbox Code Playgroud) 在Unix for Windows Porting Dictionary for HPC page for fork()中写了
Unix fork()或vfork()没有等效的Windows API.基于Unix的应用程序的Microsoft子系统(SUA或Interix)是一个正确实现fork()和vfork()的Unix环境.
在页面上还有一些示例源代码,它使用...标准的Win32 API CreateProcess函数.
我糊涂了.
该示例是否应该使用fork()来说明由SUA/Interix实现的fork()语句?
如果fork()真正实现了它所居住的头文件和lib文件?
我们在fork()和CreateThread之间有任何关系吗?CreateThread内部调用fork()有什么?
我在Linux上运行的C中编写了一个小型自定义Web服务器应用程序.当应用程序收到请求时,它调用fork()并在一个单独的进程中处理请求,该进程被chroot到包含我想要提供的文件的特定目录中.
我想将应用程序移植到Windows,但是在这个平台上没有fork()和chroot(),并且似乎没有任何直接的等价物.你能指点我在Windows中提供这个功能的简单(并且写得最好)的代码示例吗?我的C并不是那么好,所以越简越好.
为什么Windows上没有WSGIDaemonProcess?