Again, you really need to read the docs. You didn't give me enough data for me to give you a meaningful answer. It's generally a good idea to mention what programming language you are using and maybe post some code and the errors you are getting.
I could answer this question strictly from the documentation, but I would do it with some C code samples and I get the feeling you aren't using C.