This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Godot 3:

I'm trying to use this method here:
but I get error expected 1 arguments.

What is happening is that you are probably calling the "PacketPeer" class method instead of the "put_packet()" virtual method of the "NetworkedMultiplayerENet" class.

I realize that the method is not being called here:
I do not know if he should or should not, because if he should, I do not understand why he is not then.

Steps to reproduce:
Create a project with the script below on a node and run:

extends Node

const SERVER_IP = ""
const SERVER_PORT = 1510
var socketUDP =

function _ready():

function start_client():
    socketUDP.create_client(SERVER_IP, SERVER_PORT)

function send_bytes():
    var stg = "hello"
    var pac = stg.to_utf8()
    socketUDP.put_packet(pac, pac.size())
in Engine by (203 points)
edited by

1 Answer

0 votes
Best answer

I can understand what is happening.

It is calling the "putpacket()" method of the "PacketPeer" class which has the name in GDScript "put_packet()" which is the method we call:

"ClassDB::bindmethod(DMETHOD("putpacket", "buffer"), &PacketPeer::put_packet);

then "putpacket()" calls the "putpacketbuffer()" method:

that followed in "putpacketbuffer()" is called the "put_packet()" which because it is virtual, will call the method of the child class:

This will be called the "put_packet()" method of the "NetworkedMultiplayerENet" class.

by (203 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.