# XMLSocket Troubles

**URL:** <https://forum.kirupa.com/t/xmlsocket-troubles/165854>\
**Category:** Uncategorized\
**Created:** [October 14, 2005, 12:48pm UTC](https://forum.kirupa.com/t/xmlsocket-troubles/165854 "2005-10-14T12:48:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaron1987](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@aaron1987](https://forum.kirupa.com/u/aaron1987)\
**Post date:** [October 14, 2005, 12:48pm UTC](https://forum.kirupa.com/t/xmlsocket-troubles/165854/1 "2005-10-14T12:48:58Z")

</div>

hi I was wondering. anyone have an Idea on how I could get the XML socket to send information that is in a text input… called sendMessage here is the code…

```auto
function myOnConnect(success) {
	if (success) {
		messageWindow.text = "Connection succeeded!";
	} else {
		messageWindow.text = "Connection failed!";
	}
}
socket = new XMLSocket();
socket.onConnect = myOnConnect;
if (!socket.connect("localhost", 1337)) {
	messageWindow.text = "Connection failed!";
}
function closeConnection() {
	socket.close();
	messageWindow.text = "Connection Closed";
}
function sendData() {
	var myXMLSocket:XMLSocket = new XMLSocket();
	myXMLSocket.send(sendMessage.text);
	sendMessage.text = "";
}
// buttons
sendButton.onRelease = function() {
	sendData();
};
closeButton.onRelease = function() {
	closeConnection();
};

```

Thanks Again 🙂
