Find the answer to your Linux question:
Results 1 to 2 of 2

Thread: netcat in c

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    netcat in c


    hey guys, i'm using netcat as sending client application:


    sending:
    Code:
     nc -c 192.168.10.50 7331 < testfile
    receiving:
    Code:
    nc -l -p 7331 > received_testfile
    so far so good-->that works quite well

    but

    i wrote an C Porgram where i use the exact same command:
    Code:
    system("nc -l -p 7331 > received_testfile")
    but here, the file I created is always empty

    someone got an idea where i could start searching?

  2. #2
    -->
    wow...funny how things are working out....searched for hours, and minutes after writing into a forum....

    the problem was the loop
    Code:
    while(1){
    system("nc -l -p 7331 > received_testfile")
    }
    the code received the file just fine, but after that it openend the same file again for writing into it-->clears the file

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •