socket creation

U

udayahirwal2

Can i create 4 sockets on same ip address with different portnumbers.
I am working on windows mobile.
 
F

Flash Gordon

Can i create 4 sockets on same ip address with different portnumbers.
I am working on windows mobile.

You will have to ask in one of the Windows groups since this is system
specific.
 
A

Antoninus Twink

Can i create 4 sockets on same ip address with different portnumbers.
I am working on windows mobile.

There's no reason why you shouldn't be able to. Why don't you post a
snippet of whatever code isn't working?
 
K

Keith Thompson

Can i create 4 sockets on same ip address with different portnumbers.
I am working on windows mobile.

By now you may have seen a followup from "Antoninus Twink" inviting
you to post your code here. Please don't. You'll get much better
answers if you post to a newsgroup that discusses your operating
system. Sockets are not a feature of the C language.
 
T

Tomás Ó hÉilidhe

Can i create 4 sockets on same ip address with different portnumbers.
I am working on windows mobile.

Yes, you certainly can, and you can do it portably so that your code
will compile for Linux, Windows, Solaris, Playstation 3, what have
you.

You'll need to use a cross-platform library for doing so, the big two
being pCap and "Berkeley sockets".
 
W

Walter Roberson

Yes, you certainly can, and you can do it portably so that your code
will compile for Linux, Windows, Solaris, Playstation 3, what have
you.
You'll need to use a cross-platform library for doing so, the big two
being pCap and "Berkeley sockets".

If by pCap you refer to http://sourceforge.net/projects/libpcap/
then:

Operating System : All POSIX (Linux/BSD/UNIX-like OSes)

There is WinPcap, which appears to be a port that extends support
to MS Windows.

But to my mind, "what have you" includes operating systems such
as PalmOS, which is not Posix nor MS Windows, but does include
TCP/IP. Your "what have you" appears to be overly general.
 
F

Flash Gordon

Walter Roberson wrote, On 05/05/08 18:37:
The Windows implementation of sockets is not quite the same as the
Berkeley implementation.
If by pCap you refer to http://sourceforge.net/projects/libpcap/
then:

Operating System : All POSIX (Linux/BSD/UNIX-like OSes)

There is WinPcap, which appears to be a port that extends support
to MS Windows.

It does. However, WinCE, sorry, Windows Mobile, is *not* the same as
Windows.
But to my mind, "what have you" includes operating systems such
as PalmOS, which is not Posix nor MS Windows, but does include
TCP/IP. Your "what have you" appears to be overly general.

In particular I don't believe pcap supports the target of interest to
the OP. Asking on a Windows Mobile group would be the OPs best recourse
as has already been mentioned.
 
C

cr88192

Yes, you certainly can, and you can do it portably so that your code
will compile for Linux, Windows, Solaris, Playstation 3, what have
you.

You'll need to use a cross-platform library for doing so, the big two
being pCap and "Berkeley sockets".


how about this:
cross-platform socket support is just a few #ifdef's away...

sadly, IME, this is often one of the "best" ways to do inter-OS portability,
namely because, most often, these cross-platform libraries, are rarely if
ever present, and even then, usually only support a few platforms and do
things that would not be so hard to pull off, simply by using ifdef's or or
occasionally swapping out source files...


Linux, Windows, and Solaris:
this should actually be fairly easy with ifdef's, since they use fairly
similar sockets interfaces.

PS3 should be likewise, since AFAIK the thing is just running linux,
likewise for XBox (modified windows core).

WinCE is also, likewise, windows... what ever differences there are in terms
of API calls, are usually noted in the help files (usually, it is
differences along the lines of special flags working, and others having no
effect, ...).


other further systems, depends on what is provided.

IMO, "universal portability" is an ill-advised goal anyways. often I have
seen a lot more damage than good done this route. usual worst case: the code
has to be ported.

worst case, if one depends too heavily on some ill-fated portability
library:
much of the app ends up having to be discarded or rewritten...


my personal advice is too keep as much platform-specific machinery as is
reasonable in small, easily replacable, source files. these can provide a
kind of app-specific portability layer.

in this case, moving between the platforms is usually a matter of using
different source files, and moving to a new one may involve tweaking the
existing ones or adding a few new ones.

this usually works a lot better than it is given credit for...
 
C

cr88192

CBFalconer said:
Please don't reply to such off-topic queries other than to redirect
the queryier to an appropriate newsgroup. This has nothing to do
with C, and should go to some sort of windows newsgroup.

likely, one can't expect most newbs to really know the difference.
"well, I am writing in C, may as well ask the C people".

after all, many other languages (such as Java and C#, among others) include
things like sockets as part of the language, rather than as a 3rd party.

more so, a newb may not realize that most of what exists "in C" is 3rd
party, rather than being a part of the "C language".

more so, we can note that most people, may well think of programming
languages in analogy to natural languages (such as English), where a natural
language has in its propiety pretty much every concept expressable within
the language, rather than, say, the language owning the grammar, and all of
the pieces of the lexicon being 3rd party add-ons (to lookup a word, one has
to find the right dictionary for the right topic).

so, maybe one need not be too hard on newbs, or on people at least trying to
give worthwhile answers, even if not strictly on topic...

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
 
E

Eligiusz Narutowicz

Flash Gordon said:
You will have to ask in one of the Windows groups since this is system
specific.

He already had his answer. Why do you assume to be answering for other
peoples? Do you think no C programmers here have experience in real
world programs?
 
T

Tomás Ó hÉilidhe

how about this:
cross-platform socket support is just a few #ifdef's away...

sadly, IME, this is often one of the "best" ways to do inter-OS portability,
namely because, most often, these cross-platform libraries, are rarely if
ever present, and even then, usually only support a few platforms and do
things that would not be so hard to pull off, simply by using ifdef's or or
occasionally swapping out source files...


Berkeley sockets is as common as white bread. Recently I was looking
into developing a networking application before I sparked a deeper
interest in embedded systems. When I asked around as to what network
library to use, I only got two responses: Berekeley Sockets or pCap.

Asking about the two, I was told that Berkeley Sockets is the bread
and butter of doing TCP or UDP communication. I was told that it's the
most implemented, most portable. I was told that if *any* network
library was available for a certain system, then Berkeley Sockets was.

pCap and the other hand is more suitable for Datalink Layer stuff,
e.g. analysing frames and handcrafting your own frames.

Linux, Windows, and Solaris:
this should actually be fairly easy with ifdef's, since they use fairly
similar sockets interfaces.


I'd got with Berekeley Sockets. Way easier, way less bug-prown to work
with.

PS3 should be likewise, since AFAIK the thing is just running linux,
likewise for XBox (modified windows core).


Berkeley again.

WinCE is also, likewise, windows... what ever differences there are in terms
of API calls, are usually noted in the help files (usually, it is
differences along the lines of special flags working, and others having no
effect, ...).

other further systems, depends on what is provided.


Again I'd go with Berkeley.

IMO, "universal portability" is an ill-advised goal anyways. often I have
seen a lot more damage than good done this route. usual worst case: the code
has to be ported.


I myself think cross-platform development is fantastic. Look at
Mozilla Firefox or Mozilla Thunderbird. I'd love to write an
application once and to have it work on all sorts of systems.

worst case, if one depends too heavily on some ill-fated portability
library:
much of the app ends up having to be discarded or rewritten...


You can make an allegation of "ill-fated" against any library. Things
like Berkeley Sockets and wxWidgets aren't about to die out -- they're
thriving.

my personal advice is too keep as much platform-specific machinery as is
reasonable in small, easily replacable, source files. these can provide a
kind of app-specific portability layer.


I beg to differ.

in this case, moving between the platforms is usually a matter of using
different source files, and moving to a new one may involve tweaking the
existing ones or adding a few new ones.

this usually works a lot better than it is given credit for...


But it involves writing more than one chunk of code, which in turn can
result in a bug only being present on one kind of system.

There's a great book for cross-platform programming entitled "Cross-
platform development in C++".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top