Sign in to follow this  
Followers 0
Netwolf

question about tcp connection

2 posts in this topic

hi guys. 

im working on a program that can communicate over a tcp connection. 

for now only client is supposed to listen the other will send data. 

according to that data the first client will then react. 

there will only be one type of data:  different string values. 

my question is whether i need to close the socket after receiving data in order to send new data. 

or if i can just keep the socket open and basically loop tcpsend()  once the tcpconnect() is established since its the same connection. 

so basic structure : 

tcpstartup()

tcplisten()

tcpaccept() ____________________tcpconnect()

loop

tcprecv()_____________________tcpsend()

until "whatever :D " or tcpaccept = -1

tcpclosesocket(tcpaccept())

tcpclosesocket(tcplisten())

tcpshutdown()

Share this post


Link to post
Share on other sites



Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0