Need some suggestion about Socket Programming use C

This is a discussion on Need some suggestion about Socket Programming use C within the C Programming forums, part of the General Programming Boards category; Need some suggestion about Socket Programming use C Hi, I am a student who just begin to learn socket programming ...

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    13

    Question Need some suggestion about Socket Programming use C

    Need some suggestion about Socket Programming use C

    Hi,

    I am a student who just begin to learn socket programming use C. And I will finish a project about this.
    So I want to learn it at first and know some basic things about this.

    I will program it and test and run it in my University's FreeBSD server.
    And I found that there is only VI editor for me to use.
    It's hard to use.
    also hard to debug my program.

    Any suggestion about this?

    How can I write code and debug it efficiently?

    Thank you all guys so much.
    my English is poor, sorry for that!

    ReDe

  2. #2
    Registered User
    Join Date
    Apr 2009
    Posts
    66

    Lost of things in vi

    You must learn the vi first to use it , Then you will feel like no editor is comparable to vi.
    there are several options are available in vi to find the error by seeing itself.

    Possibly you can install many vim plugins at free of cost.

    First you try with this

    Code:
    :syn on
    which enable the syntax ON.

    For more understanding of vi refer :
    Mastering the VI editor

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Rede View Post
    I will program it and test and run it in my University's FreeBSD server.
    And I found that there is only VI editor for me to use.
    It's hard to use.
    Some people just don't appreciate anything

    You probably have the full fledged "VIM" (type: vim) since vi is just a simplified version
    VIM: The (un)official thread

    Re: debugging -- check and see if you have "gdb" available.

    I believe FreeBSD is historically the origin of the C socket, anyway it will not be a problem, you are doing unix style socket programming.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    Registered User
    Join Date
    Feb 2010
    Posts
    37
    Hi buddy! If u want to know the basic things about vi editor just give the vimtutor command.
    It will help you to get familiar in vi editor. For flexible debugging on your code you can use ddd command

  5. #5
    Registered User
    Join Date
    Feb 2010
    Posts
    13
    Thank you very much!
    But I have not root authority for Server. So I cannot install plugin.
    still thank you so much.

    also hoping more other suggestion

  6. #6
    Registered User
    Join Date
    Feb 2010
    Posts
    26
    visit the following link for socket programming in c.
    Programming in C

    Visit this link for vi text editor tutorial.
    https://engineering.purdue.edu/ECN/S...EditorTutorial

  7. #7
    Registered User
    Join Date
    Feb 2010
    Posts
    13
    Plus, another trivial question..
    If I wanna delete one character in VI due to typo...what is the quickest way to do so?
    my way is:

    1 press "esc"
    2 press "x"
    3 press "a"
    then go back coding ..

    am I right or do redundant operation?

  8. #8
    Registered User
    Join Date
    Feb 2010
    Posts
    37
    if u want to delete more characters consider the following example
    this is for testing
    Your cursor is in 'e' in the word "testing" if u pressed D then it will delete up to the last character in that line

  9. #9
    Registered User
    Join Date
    Feb 2010
    Posts
    37
    At first you have to be in esc mode. so press esc. And then press 'D' key for deleting up to the last character in that line.

  10. #10
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    VIM will probably be a lot more useful with a ".vimrc". You have an account on the server, it is a plain text file in your ~ (home) directory. If you google "vimrc" you'll find stuff. VIM documentation is chaotic but there's lots of it online.

    Here's a totally excessive .vimrc that should take a few months to decypher:
    The ultimate Vim configuration (vimrc)

    Here's a more minimal example:
    Code:
    :syntax enable
    command SpellOn setlocal spell spelllang=en_us
    command SpellOff setlocal nospell
    " spell suggest: z=
    
    set number
    set nowrap
    set bs=indent,eol,start         " allow backspacing over everything in insert mode
    set list listchars=tab:\|_,trail:-
    set tabstop=4
    set shiftwidth=4
    set wildmenu
    set ruler
    set virtualedit=all             " virtual space at line end
    set hlsearch            " highlight search hits
    set autoread            " update when file is altered elsewhere
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  11. #11
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Rede View Post
    Plus, another trivial question..
    If I wanna delete one character in VI due to typo...what is the quickest way to do so?
    Just use backspace or delete. You may have to set this line in the aforementioned .vimrc:
    Code:
    set bs=indent,eol,start         " allow backspacing over everything in insert mode
    Hopefully you understand
    insert VS command (aka. escape) mode
    at this point.

    If not, DO NOT PASS GO! That's not a link, you'll have to google.
    Last edited by MK27; 02-19-2010 at 10:57 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  12. #12
    Registered User
    Join Date
    Feb 2010
    Posts
    37
    filetype plugin indent on

    Please add the above line too in that .vimrc file.
    It will make clear alignment in ur code automatically when u r writing your code.
    You don't have to worry about making indention in your code.

  13. #13
    Registered User
    Join Date
    Feb 2010
    Posts
    13
    yes, I understood insert VS command (aka. escape) mode. no problem
    I have create .vimrc On server under my directory. paster those code you gave me.
    But nothing changed...How it gonna to work?

  14. #14
    Registered User
    Join Date
    Feb 2010
    Posts
    37
    can you tell me where you have created that vimrc file?
    It should be under your /home/ directory. i.e. /home/rede/.vimrc.
    Am I correct?

  15. #15
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Here's a test. Add this to the .vimrc:
    Code:
    :imap <F4> for (i=0;i ;i++)
    Now press F4 in INSERT mode. The blue part should appear.

    You have to restart vim first. If this does not work, email the system administrator.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Socket error on non-blocking
    By newbie30 in forum C Programming
    Replies: 1
    Last Post: 09-01-2009, 08:09 AM
  2. Function call from another .c module
    By Ali.B in forum C Programming
    Replies: 14
    Last Post: 08-03-2009, 12:45 PM
  3. Problem with socket descriptors
    By McKracken in forum C Programming
    Replies: 1
    Last Post: 07-22-2009, 09:51 AM
  4. socket programming question, closing sockets...
    By ursula in forum Networking/Device Communication
    Replies: 2
    Last Post: 05-31-2009, 06:17 PM
  5. socket newbie, losing a few chars from server to client
    By registering in forum Linux Programming
    Replies: 2
    Last Post: 06-07-2003, 12:48 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21