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

Issues with udp:send() and udp:sendto() #230

Open
ojmakke opened this issue Sep 19, 2017 · 0 comments
Open

Issues with udp:send() and udp:sendto() #230

ojmakke opened this issue Sep 19, 2017 · 0 comments

Comments

@ojmakke
Copy link

ojmakke commented Sep 19, 2017

Hello,
I am new to Lua here.

I have a receiver side code:


local socket = require("socket")
local ip, port = "127.0.0.1", 9999
local udp = assert(socket.udp())
udp:setsockname(ip, port)

while 1 do
    a  = assert(udp:receive());
    print(a);
end

And a transmitter code:

local socket = require("socket")
local ip, port = "127.0.0.1", 9999


local udp = assert(socket.udp())
udp:setpeername(ip, port)

a = ""
for ii = 1,10000 do
    a = a .. " " .. ii
end

--udp:sendto(a, ip, port)
udp:send(a)
udp:close()

Using this code, I can only send 8193 bytes. First question is: Why?

Now, if I remove
udp:setpeername(ip, port)

and use:
udp:sendto(a, ip, port)

I do not receive anything!
Second question: Why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant