Jump to content

question about tcp connection


Recommended Posts

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()

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...