aboutsummaryrefslogtreecommitdiff
path: root/core/io/tcp_server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/io/tcp_server.cpp')
-rw-r--r--core/io/tcp_server.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp
index 274d20a48..bfa5dce58 100644
--- a/core/io/tcp_server.cpp
+++ b/core/io/tcp_server.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -44,26 +44,33 @@ TCP_Server* TCP_Server::create() {
return _create();
}
-Error TCP_Server::_listen(uint16_t p_port,DVector<String> p_accepted_hosts) {
+Error TCP_Server::_listen(uint16_t p_port, PoolVector<String> p_accepted_hosts) {
List<String> hosts;
for(int i=0;i<p_accepted_hosts.size();i++)
hosts.push_back(p_accepted_hosts.get(i));
- return listen(p_port,hosts.size()?&hosts:NULL);
+ return listen(p_port, hosts.size()?&hosts:NULL);
}
+void TCP_Server::set_ip_type(IP::Type p_type) {
+ stop();
+ ip_type = p_type;
+}
+
void TCP_Server::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("listen","port","accepted_hosts"),&TCP_Server::_listen,DEFVAL(DVector<String>()));
- ObjectTypeDB::bind_method(_MD("is_connection_available"),&TCP_Server::is_connection_available);
- ObjectTypeDB::bind_method(_MD("take_connection"),&TCP_Server::take_connection);
- ObjectTypeDB::bind_method(_MD("stop"),&TCP_Server::stop);
+ ClassDB::bind_method(_MD("set_ip_type","ip_type"),&TCP_Server::set_ip_type);
+ ClassDB::bind_method(_MD("listen","port","accepted_hosts"),&TCP_Server::_listen,DEFVAL(PoolVector<String>()));
+ ClassDB::bind_method(_MD("is_connection_available"),&TCP_Server::is_connection_available);
+ ClassDB::bind_method(_MD("take_connection"),&TCP_Server::take_connection);
+ ClassDB::bind_method(_MD("stop"),&TCP_Server::stop);
}
TCP_Server::TCP_Server()
{
+ ip_type = IP::TYPE_ANY;
}