问题描述
在 golang 中使用 unix 套接字创建服务器应用程序
服务器应用代码:
package main
import (
"fmt"
"net"
"net/http"
"os"
)
func main() {
sock := "/var/web.sock"
err := os.Remove(sock)
if err != nil {
fmt.Printf("Can not remove socket config file.")
}
unixListener,err := net.Listen("unix",sock)
if err != nil {
fmt.Printf("Can not create unix socket listener,")
}
http.HandleFunc("/3dviewer/upload",uploadFile)
http.Serve(unixListener,nil)
}
func uploadFile(w http.ResponseWriter,r *http.Request) {
fmt.Printf("WORKING")
}
需要客户端角度代码才能连接到服务器应用程序。请有人可以帮助我。
提前致谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)