# Unix (AIX) Programming Help



## coderitr (Oct 12, 2003)

I've been tasked with writing (rewriting) my company's credit card settlement process. I've already done the part that takes the transaction data and loads it into a reserved Oracle table and now have to write the actual transmission to the settlement provider. The problem is, I don't know what I'm doing when it comes to writing code for the Unix platform. The protocol is very specific and was originally designed for a modem but I will be transmitting over TCP/IP on a private circuit. There are several timers that my program has to maintain to enable timeouts and retransmissions and such; therefore this program must be multithreaded. I know about the fork( ) function in AIX C but it simply creates a copy of the existing thread (right?) according to the documentation I have. I really need some help here. Anything will be appreciated. Where do I start? Is there something I'm not seeing that will allow me to fire off another (separate) thread in AIX? Please help. Thanks.


----------



## AGCurry (Jun 15, 2005)

You're over your head, aren't you? Your management needs to realize that they must either give you the time to learn this stuff, or hire a contractor who can do it quickly.

That said, you're on the right track with fork(). It just creates a new process; what you do with that process is up to you. I would recommend two books, both by Richard Stevens: "Advanced Programming in the Unix Environment", and "Unix Network Programming." They're big books, but everything you will need - except for the Oracle stuff - is in there.


----------



## coderitr (Oct 12, 2003)

AGCurry said:


> You're over your head, aren't you?


How'd you guess?  I can do darn near anything my management needs on a Windows platform and I maintain an AIX application already but the original source isn't mine. I plod along in that one when I need to make changes very very carefully.



AGCurry said:


> That said, you're on the right track with fork(). It just creates a new process; what you do with that process is up to you. I would recommend two books, both by Richard Stevens: "Advanced Programming in the Unix Environment", and "Unix Network Programming." They're big books, but everything you will need - except for the Oracle stuff - is in there.


Thanks, friend. The Oracle stuff I can handle with embedded SQL and a precompiler. The rest? At this point I don't even know what I don't know. Unfortunately, this has to be done in the next 4 to 6 weeks.


----------



## AGCurry (Jun 15, 2005)

You know, TCP/IP is really very reliable. I could understand using a timer thread if you were using UDP, but I've written several sockets and none of them have needed timers. If I were designing this thing you describe, I would create a file first; when I had transferred filesize bytes, I'd know I was done. FTP is also an option.

I just got through writing a socket in C which downloads a TIFF file from a web page, using HTTP POST method. It's all stuff that'll look good on your resume!


----------



## coderitr (Oct 12, 2003)

The protocol is very strictly defined. I can't use FTP and I must wait for a response after every record. I get different responses for different record type and that response drives what I send next. I wish it was as simple as building a file and sending it over a socket. That I could handle. This other thing is one gigantic pain in the rump that was designed 20 years ago to be transmitted over a 300 bps modem. The provider just hasn't felt like updating it for the 21st century.


----------



## AGCurry (Jun 15, 2005)

Two words: JOB SECURITY. Lucky you!


----------

