cancel
Showing results for 
Search instead for 
Did you mean: 

winsock user object (deveolped by roland smith) worked first and now does not

Former Member
0 Kudos
88

I have posted a question on this topic before, I have to send data to one of oru .net app via a socket. I used winsock object dveloped by roland smith (team sybase) it worked perfectly and I was able to send data to the listening program but now suddenly it has stopped working. My coworker who is working on .net app has told me that nothing has changed on his side and I have not changed anything on my side. I am using roland's program as it is but now it has stopped working. I am using follwoing method exactly as it is in roland's example to create a scoket:

lul_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) following are the values when creating the socket

Constant Long AF_INET = 2

Constant Long SOMAXCONN = 2147483647

Constant Long SOCK_STREAM = 1

Constant Long SOCK_DGRAM = 2

Constant Long IPPROTO_TCP = 6

as you can see even the values passed to socket method are the same. I beleive the problem is in of_getsockopt method

Constant Long SOL_SOCKET = 65535
Long ll_optname, ll_optvalue, ll_buflen

ll_buflen = 4

choose case Upper(as_optname)
case "SO_ERROR"
  ll_optname = 4103
case "SO_RCVBUF"
  ll_optname = 4098
case "SO_SNDBUF"
  ll_optname = 4097
case "SO_TYPE"
  ll_optname = 4104
case else
  Return SOCKET_ERROR
end choose

// get option value
If getsockopt(aul_socket, SOL_SOCKET, &
    ll_optname, ll_optvalue, ll_buflen) = 0 Then
Return ll_optvalue
Else
Return SOCKET_ERROR
End If

I beleive that .net program on the lsitening side has set some option that I am not setting on my side and then I call this of_getsockopt mehtod that returns an invalid value and because of that I am not able to write to the socket. Create socket and connect socket does not return any error message. Does the ll_buflen value has to correspond to some value set by the listening program? I am really desperate becuase nothing is working and it did work last week perfectly, I can't figure out what changed on which side? can someone help please?

Accepted Solutions (0)

Answers (1)

Answers (1)

arnd_schmidt
Active Contributor
0 Kudos

ll_optvalue (long = 4 bytes) is passed by reference as an output buffer for the requested option value.

ll_buflen is the size in bytes for the output buffer (ll_optvalue) .. so it's 4.

Which option do you wanted to get and what was the "invalid value"?

Former Member
0 Kudos

Arnd: I am trying to get the SO_SNDBUF option, as for the invalid value I am just assuming that may be the problem as for as getting an error message from of_getsockopt if I call of_getlasterror() I do not get any error, I am just surprised that this program worked fine few weeks ago and I was able to send data to the listening prog and now without changing anything it suddenly does not work.