Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/sys/windows: Windows does not implement Sendmsg, Recvmsg #7170

Closed
gopherbot opened this issue Jan 22, 2014 · 6 comments
Closed

x/sys/windows: Windows does not implement Sendmsg, Recvmsg #7170

gopherbot opened this issue Jan 22, 2014 · 6 comments
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done. OS-Windows
Milestone

Comments

@gopherbot
Copy link

by jikai507:

My code is:
package main

import (
    . "fmt"
    "syscall"
)

func MAKEWORD(low, high uint8) uint32 {
    var ret uint16 = uint16(high)<<8 + uint16(low)
    return uint32(ret)
}

func main() {
    var (
        sock    syscall.Handle
        addr    syscall.SockaddrInet4
        wsadata syscall.WSAData
        err     error
    )
    err = syscall.WSAStartup(MAKEWORD(2, 2), &wsadata)
    if err != nil {
        Println("Startup error")
        return
    }
    defer syscall.WSACleanup()

    sock, err = syscall.Socket(syscall.AF_INET, syscall.SOCK_STREAM, syscall.IPPROTO_IP)
    if err != nil {
        Println("Socket error")
        return
    }
    defer syscall.Closesocket(sock)

    addr.Addr[0] = 61
    addr.Addr[1] = 135
    addr.Addr[2] = 169
    addr.Addr[3] = 125
    addr.Port = 80

    err = syscall.Connect(sock, &addr)
    if err != nil {
        Println("Connect error")
        return
    }

    err = syscall.Sendto(sock, []byte("hello"), 0, &addr) /////Here has some trouble
    if err != nil {
        Println("Send error")
    } else {
        Println("Send success")
    }
}

It can compile well but the output is "Send error", so may the problem happen
in the the call of syscall.Sendto(...)

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1.
2.
3.

What is the expected output?


What do you see instead?


Which compiler are you using (5g, 6g, 8g, gccgo)?


Which operating system are you using?
Windows

Which version are you using?  (run 'go version')
go v1.2

Please provide any additional information below.
@alexbrainman
Copy link
Member

Comment 2:

And why should we implement syscall.Sendto?
Alex

Status changed to WaitingForReply.

@rsc
Copy link
Contributor

rsc commented Mar 4, 2014

Comment 3:

Labels changed: added release-none.

@rsc rsc removed the os-windows label Apr 10, 2015
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@ivan386
Copy link

ivan386 commented Jan 9, 2019

I try many ways to get raw ip packet from socket and stuck with this error on windows. Maybe it's time to fix it?

@ianlancetaylor ianlancetaylor changed the title syscall: Windows does not implement Sendto, Recvfrom, Sendmsg, Recvmsg x/sys/windows: Windows does not implement Sendmsg, Recvmsg Jan 10, 2019
@ianlancetaylor
Copy link
Contributor

The syscall package is now frozen, so the place for these functions would be golang.org/x/sys/windows. It looks like Sendto and Recvfrom are implemented, but that Sendmsg and Recvmsg are still missing.

Go is an open source project. Patches welcome.

@ianlancetaylor ianlancetaylor added help wanted NeedsFix The path to resolution is known, but the work has not been done. labels Jan 10, 2019
@gopherbot
Copy link
Author

Change https://golang.org/cl/208321 mentions this issue: windows: add Recvfrom and Sendto implementations

@golang golang locked and limited conversation to collaborators Nov 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done. OS-Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants