+ Post New Thread
Results 1 to 2 of 2
  1. #1
    Member level 1
    Points: 236, Level: 2

    Join Date
    Mar 2018
    Posts
    33
    Helped
    0 / 0
    Points
    236
    Level
    2

    Linux socket programming

    Hi

    I am new to socket programming in linux. I was referring to this site https://www.thegeekstuff.com/2011/12...rce=feedburner . I took the example of server code and executed it.

    Issues

    1. The example program closes the socket at end of this routine. Therefore I have to establish connections everytime from client. How should the code be modified to make server always live (without closing unless client disconnects)?

    2. I also faced issues with byte transmission. Data in the range 0-9 is received in client perfectly, but the data greater than 9 is received wrongly. For example 10 is received as 1 and a 0 separately. Any ways to resolve this?

    •   Alt10th June 2018, 07:01

      advertising

        
       

  2. #2
    Full Member level 3
    Points: 4,421, Level: 15

    Join Date
    Apr 2001
    Location
    California, USA
    Posts
    187
    Helped
    25 / 25
    Points
    4,421
    Level
    15

    Re: Linux socket programming

    You need to provide more information. The given program must close socket after sending info to client. I guess that you need to define protocol first (what is client going to send to server, and what server should send as a response). Look at this example on how to implement multi threaded server: https://gist.github.com/oleksiiBobko...3c25c03bcc9b2b



--[[ ]]--