Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

Is it possible to run Linux C network program can run on MS Dos...

Dear friends...

      I wrote network program in Linux C Programming. now i like to run it on Windows (Ms dos). i have a compiler djgpp. But i didnt compile socket system calls... I copied that header file from linux to windows and also PATH.

      Plz help me to solve this problem...

urs
prakash
0
haiprakash
Asked:
haiprakash
  • 2
2 Solutions
 
akshayxxCommented:
not the linux socket program will not compile/run on windows as it is .. and header files are nuthing but prototype of function calls..
u'll need the socket library.. and for windows it is called winsock.. look for tutorials on web .. how to write sample network programs using winsock
0
 
akshayxxCommented:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcecomm/htm/_wcesdk_winsock_sample_applications.asp

follow the above link for sample applications using winsock..

which windows version are u using .. i hope its not MSDOS?
0
 
BabuPrasannaCommented:
Just create "console application" project in the VC++ and add the files to it. Now u need to add the ws2_32.lib to your project(Add files to project option).And #include<winsock2.h> at the start instead of all the <sock.h> etc..etc.. I had assumed that you have used the POSIX standards for coding.

Now Call the WSAStartup() function before any of the network calls(socket,connect..etc..etc)and call any of your designed function. Refer MSDN for the WSAStartup() function.
Windows has support libraries for the unix to windows portability of network programs.

Now compile the code and run!

Remember, a code generated(exe) for one OS can never work in any other OS by just replacing the ".h" files. You need to recompile them with the corresponding .lib and .h files.
0
 
jmcgOwnerCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: akshayxx {http:#7991670} & BabuPrasanna {http:#8007024}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now