# Questions about sockets and checking for recieved data

**URL:** <https://forum.defold.com/t/questions-about-sockets-and-checking-for-recieved-data/23560>\
**Category:** Questions\
**Created:** [July 1, 2018, 7:58am UTC](https://forum.defold.com/t/questions-about-sockets-and-checking-for-recieved-data/23560 "2018-07-01T07:58:00Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [July 18, 2018, 5:46am UTC](https://forum.defold.com/t/questions-about-sockets-and-checking-for-recieved-data/23560/21 "2018-07-18T05:46:06Z")

</div>

Well, if you don’t add a newline to the data you send then receive(“\*l”) will never finish since you’re using blocking sockets without a timeout. “\*a” will read until you close the socket, and that’s probably not what you want.

---

<div class="post-metadata">

**Author:** ![serifaz](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/serifaz/32/8714_2.png) [@serifaz](https://forum.defold.com/u/serifaz)\
**Post date:** [July 18, 2018, 1:01pm UTC](https://forum.defold.com/t/questions-about-sockets-and-checking-for-recieved-data/23560/22 "2018-07-18T13:01:12Z")

</div>

yeah I tried the “\*a” it still didn’t fix it. I’m going to check back on my server and make sure I didn’t miss something.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [July 18, 2018, 7:35pm UTC](https://forum.defold.com/t/questions-about-sockets-and-checking-for-recieved-data/23560/23 "2018-07-18T19:35:57Z")

</div>

If you’re never closing the socket then “\*a” will block the execution indefinitely while constantly reading data. You will never be able to read any of it.

I still don’t really understand what you’re doing. Are you using the socket to do user authentication only? How does your server know that it is a username and password you’re sending? And how does it know when to stop reading the data you’re sending? You’re not using any message buffer system or anything where you are differentiating between different messages both when sending and receiving data.

It feels like you’re trying to do fairly complicated socket communication without enough knowledge of how such things are typically done.

[Previous page](https://forum.defold.com/t/questions-about-sockets-and-checking-for-recieved-data/23560.md?page=1)
