Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I got some errors #1

Open
CloudFeng opened this issue Aug 10, 2015 · 2 comments
Open

I got some errors #1

CloudFeng opened this issue Aug 10, 2015 · 2 comments
Assignees

Comments

@CloudFeng
Copy link

using this project some errors in my environment

environment

  • vs 2013
  • 64bit

errors

  1. add a line code in stocketpair.h
#pragma comment(lib, "Ws2_32.lib")
  1. in main.c
thread_t thread;
socket_t sockets[2];

error: this declaration has no storage class or type specifier
after changed:

HANDLE thread;
SOCKET sockets[2];
  1. in read_bytes function
total += recv(sockets[1], &buf[total], (int)(numbytes - total), 0);

argument of type "char (*)[81920]" is incompatible with parameter of type "char *"
buf is a point to point, why use &buf[total].
After changed:

total += recv(sockets[1], buf[total], (int)(numbytes - total), 0);

build and result

When build this project, then call init[] in q thread,sometime it said:wsfull;
sometime it crached. I don't know why, now I try to solve it.Could have some one face this problem? Thanks.

@markrooney
Copy link
Contributor

I'll install VS 2013 and have a look into the build errors.

@markrooney markrooney self-assigned this Aug 11, 2015
@CloudFeng
Copy link
Author

I solve the errors which I faced

  • in stocketpair.h file
    add #pragma comment(lib, "ws2_32.lib")
#ifdef WIN32
# include <ws2tcpip.h>  /* socklen_t, et al (MSVC20xx) */
#pragma comment(lib, "ws2_32.lib")
# include <windows.h>
# include <io.h>
#else
# include <sys/types.h>
# include <sys/socket.h>
# include <errno.h>
#endif
  • I changed read_bytes and recieve_data functions, as followed
// read_bytes:read data from sockets[1]
void read_bytes(size_t numbytes, char buf[BUFFER_SIZE])
{
    int total = 0;
    do {
        total += recv(sockets[1], &buf[total], (int)(numbytes - total), 0);
    } while (total < numbytes);
}

K recieve_data(I x)
{
    static char buf[BUFFER_SIZE];
    read_bytes(sizeof(int), buf);
    int tnamesize = 0;
    memcpy(&tnamesize, buf, sizeof(int));
    read_bytes(tnamesize, buf);
    buf[tnamesize] = '\0';
    K tname = ks(buf);
    read_bytes(sizeof(J), buf);
    J size = 0;
    memcpy(&size, buf, sizeof(J));
    read_bytes(size, buf);
    K bytes = ktn(KG, size);
    memcpy(kG(bytes), &buf, (size_t)size);
    K result = k(0, ".u.upd", tname, d9(bytes), (K)0);
    r0(bytes);
    if (result != 0) {
        r0(result);
    }
    return (K)0;
}
  • in run.q file, I also mended some code.Just delete
`g# / table attribute, it costs lots of memory
  • BYW, I delete time colnum, as follow. However, it does work, the result is
    empty table.
trade:([]sym:symbol$(); exg:`symbol$(); size:(); volume:(); sequence:(); price:(); cond:());
.u.upd:{[t;x] insert[t] each 'flip x; }

use the raze function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants