we are writing a messaging program for lans and we are distributing it
through the internet.
However, we encountered a problem with the sockets:
The program opens a server socket on startup. On most computers there is no
problem, but on some machiches we get the error "couldn't open socket:
invalid argument".
We tried to reproduce this error at our computers, and we found out, that
this error appears, if you do not have tcp/ip installed, or if you are using
dynamic IP-addresses.
But now we have a client who has the same error, but none of the above
reasons is applicable...
Do you know, when this error comes up?
cIao
Mat
ps: yes, the progam works on some machines, so I don't think it's a matter
with the sources...
Are you sure none of those is applicable? socket just won't work
on a machine without TCP/IP (of course), but it should work fine
when you have DHCP set up (I use this all the time). Perhaps you
can elaborate more on what your setup is. Is there some sort of
non-standard IP stack being used?
--
Jeff Hobbs The Tcl Guy
Senior Developer http://www.ActiveState.com/
Tcl Support and Productivity Solutions
Yes, TCP/IP is installed and he also set a static IP... . Everywhere where
we set to dynamical Ips, we got this error. Perhaps, I should mention that
we are using Windows PCs :-) . I asked the client to send us the settings he
made to his tcp/ip protocol, perhaps we get a clue then.
I don't know if it matters, but here's our socket code:
catch {set s_msg [socket -server msg_accept -myaddr [info hostname]
$lanmailport]} socketresponse
if {[string range $socketresponse 0 3] != "sock"} then {
switch $socketresponse {
"couldn't open socket: address already in use" {set socketerrormsg
"$l_106\n$socketresponse"}
"couldn't open socket: invalid argument" {set socketerrormsg
"$l_123\n$socketresponse"}
default {set socketerrormsg "$l_124\n$socketresponse"}
}
}
Please tell me, if you need more code
cIao
Mat
I guess that when you are using dynamic IP Addresses, [info hostname] is
not returning what you expect. Windows PC's have an embarrassing number of
names, and I suspect that you are getting a wrong'un.
In an interactive tclsh try:
% ping [info hostname]
And see if that gives you any clues.
Hope that helps.
Dan
--
Dan Smart. C++ Programming and Mentoring.
cpp...@dansmart.com
Hello,
thanks for your post. perhaps, we could use your code, however it still does
not solve our problem... the user has static ips and the same piece of code
works on many other computers....
Do you have other ideas?
cIao
Mat