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

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Jan 22, 2014

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

@alexbrainman alexbrainman commented Jan 22, 2014

Comment 2:

And why should we implement syscall.Sendto?
Alex

Status changed to WaitingForReply.

@rsc
Copy link
Contributor

@rsc 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
@rsc rsc added OS-Windows and removed release-none labels Apr 10, 2015
@ivan386
Copy link

@ivan386 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

@ianlancetaylor ianlancetaylor commented Jan 10, 2019

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.

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Nov 27, 2019

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.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

6 participants
You can’t perform that action at this time.