public void NewConnection(StreamPeerTCP conn, long counter) { foreach (var obj in objects) { conn.PutVar(SendObject(obj.Value)); } }
public override void _Ready() { client = new StreamPeerTCP(); compressionThreshold = -1; // force init PacketType.init(); }
public Client(string ip, int port) { StreamPeerTCP t = new StreamPeerTCP(); GodotError.Assert(t.ConnectToHost(ip, port)); // Always gives zero tcp = new StreamPeerTCPStream(t); reader = new BinaryReader(tcp); writer = new BinaryWriter(tcp); }
public void Join(string ip = "127.0.0.1", int port = 27015) { // counter = 1; // connections.Clear(); tcpstream = new StreamPeerTCP(); // tcppeer = new PacketPeerStream(); // tcppeer.StreamPeer = tcpstream; tcpstream.ConnectToHost(ip, port); }
public ServerMessage(StreamPeerTCP socket) { var _size = Utilites.Byte2IntBE((byte[])socket.GetData(4)[1]); cmd = (NET_CMD)Utilites.Byte2UShortBE((byte[])socket.GetData(2)[1]); seq = Utilites.Byte2UShortBE((byte[])socket.GetData(2)[1]); var _data = (byte[])socket.GetData(_size)[1]; data = SimpleJSON.JSON.Parse(System.Text.Encoding.UTF8.GetString(_data, 0, _size)); }
public static string AuthOnServer(string ip, int port) { socket = new StreamPeerTCP(); var status = socket.ConnectToHost(ip, port); if (status != Error.Ok) { return(status.ToString()); } Send(NET_CMD.INSTALL, SimpleJSON.JSON.Parse("{}")); return(null); }
public int ReadNextVarIntFromStream(StreamPeerTCP stream) { int i = 0; int j = 0; int k; while (true) { k = stream.GetU8(); i |= (k & 0x7F) << j++ *7; if (j > 5) { throw new OverflowException("VarInt too big "); } if ((k & 0x80) != 128) { break; } } return(i); }
public StreamPeerTCPStream(StreamPeerTCP tcp) { this.tcp = tcp; }
// Called when the node enters the scene tree for the first time. public override void _Ready() { client = new StreamPeerTCP(); client.SetBigEndian(true); }